summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/WebKit/Source/modules/websockets/WebSocketChannel.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/WebKit/Source/modules/websockets/WebSocketChannel.h')
-rw-r--r--chromium/third_party/WebKit/Source/modules/websockets/WebSocketChannel.h27
1 files changed, 14 insertions, 13 deletions
diff --git a/chromium/third_party/WebKit/Source/modules/websockets/WebSocketChannel.h b/chromium/third_party/WebKit/Source/modules/websockets/WebSocketChannel.h
index fe63eaa7c19..6d29a69fa56 100644
--- a/chromium/third_party/WebKit/Source/modules/websockets/WebSocketChannel.h
+++ b/chromium/third_party/WebKit/Source/modules/websockets/WebSocketChannel.h
@@ -32,9 +32,11 @@
#define WebSocketChannel_h
#include "core/frame/ConsoleTypes.h"
+#include "platform/heap/Handle.h"
#include "wtf/Forward.h"
#include "wtf/Noncopyable.h"
#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
#include "wtf/text/WTFString.h"
namespace WebCore {
@@ -44,11 +46,14 @@ class KURL;
class ExecutionContext;
class WebSocketChannelClient;
-class WebSocketChannel {
+// FIXME: WebSocketChannel needs to be RefCountedGarbageCollected to support manual ref/deref
+// in MainThreadWebSocketChannelImpl. We should change it to GarbageCollectedFinalized once
+// we remove MainThreadWebSocketChannelImpl.
+class WebSocketChannel : public RefCountedWillBeRefCountedGarbageCollected<WebSocketChannel> {
WTF_MAKE_NONCOPYABLE(WebSocketChannel);
public:
WebSocketChannel() { }
- static PassRefPtr<WebSocketChannel> create(ExecutionContext*, WebSocketChannelClient*);
+ static PassRefPtrWillBeRawPtr<WebSocketChannel> create(ExecutionContext*, WebSocketChannelClient*);
enum SendResult {
SendSuccess,
@@ -75,13 +80,14 @@ public:
CloseEventCodeMaximumUserDefined = 4999
};
- virtual void connect(const KURL&, const String& protocol) = 0;
- virtual String subprotocol() = 0; // Will be available after didConnect() callback is invoked.
- virtual String extensions() = 0; // Will be available after didConnect() callback is invoked.
+ virtual bool connect(const KURL&, const String& protocol) = 0;
virtual SendResult send(const String& message) = 0;
virtual SendResult send(const ArrayBuffer&, unsigned byteOffset, unsigned byteLength) = 0;
virtual SendResult send(PassRefPtr<BlobDataHandle>) = 0;
- virtual unsigned long bufferedAmount() const = 0;
+
+ // For WorkerThreadableWebSocketChannel.
+ virtual SendResult send(PassOwnPtr<Vector<char> >) = 0;
+
virtual void close(int code, const String& reason) = 0;
// Log the reason text and close the connection. Will call didClose().
@@ -96,20 +102,15 @@ public:
// You can specify String() and 0 for sourceURL and lineNumber
// respectively, if you can't / needn't provide the information.
virtual void fail(const String& reason, MessageLevel, const String& sourceURL, unsigned lineNumber) = 0;
- void fail(const String& reason, MessageLevel level) { fail(reason, level, String(), 0); }
virtual void disconnect() = 0; // Will suppress didClose().
virtual void suspend() = 0;
virtual void resume() = 0;
- void ref() { refWebSocketChannel(); }
- void deref() { derefWebSocketChannel(); }
-
-protected:
virtual ~WebSocketChannel() { }
- virtual void refWebSocketChannel() = 0;
- virtual void derefWebSocketChannel() = 0;
+
+ virtual void trace(Visitor*) { }
};
} // namespace WebCore