OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #ifndef WebSocketChannel_h | 31 #ifndef WebSocketChannel_h |
32 #define WebSocketChannel_h | 32 #define WebSocketChannel_h |
33 | 33 |
34 #include "bindings/core/v8/SourceLocation.h" | 34 #include "bindings/core/v8/SourceLocation.h" |
35 #include "modules/ModulesExport.h" | 35 #include "modules/ModulesExport.h" |
36 #include "platform/heap/Handle.h" | 36 #include "platform/heap/Handle.h" |
37 #include "platform/v8_inspector/public/ConsoleTypes.h" | 37 #include "platform/v8_inspector/public/ConsoleTypes.h" |
38 #include "wtf/Forward.h" | 38 #include "wtf/Forward.h" |
39 #include "wtf/Noncopyable.h" | 39 #include "wtf/Noncopyable.h" |
40 #include <memory> | |
41 | 40 |
42 namespace blink { | 41 namespace blink { |
43 | 42 |
44 class BlobDataHandle; | 43 class BlobDataHandle; |
45 class DOMArrayBuffer; | 44 class DOMArrayBuffer; |
46 class ExecutionContext; | 45 class ExecutionContext; |
47 class KURL; | 46 class KURL; |
48 class WebSocketChannelClient; | 47 class WebSocketChannelClient; |
49 | 48 |
50 class MODULES_EXPORT WebSocketChannel : public GarbageCollectedFinalized<WebSock
etChannel> { | 49 class MODULES_EXPORT WebSocketChannel : public GarbageCollectedFinalized<WebSock
etChannel> { |
(...skipping 20 matching lines...) Expand all Loading... |
71 CloseEventCodeMinimumUserDefined = 3000, | 70 CloseEventCodeMinimumUserDefined = 3000, |
72 CloseEventCodeMaximumUserDefined = 4999 | 71 CloseEventCodeMaximumUserDefined = 4999 |
73 }; | 72 }; |
74 | 73 |
75 virtual bool connect(const KURL&, const String& protocol) = 0; | 74 virtual bool connect(const KURL&, const String& protocol) = 0; |
76 virtual void send(const CString&) = 0; | 75 virtual void send(const CString&) = 0; |
77 virtual void send(const DOMArrayBuffer&, unsigned byteOffset, unsigned byteL
ength) = 0; | 76 virtual void send(const DOMArrayBuffer&, unsigned byteOffset, unsigned byteL
ength) = 0; |
78 virtual void send(PassRefPtr<BlobDataHandle>) = 0; | 77 virtual void send(PassRefPtr<BlobDataHandle>) = 0; |
79 | 78 |
80 // For WorkerWebSocketChannel. | 79 // For WorkerWebSocketChannel. |
81 virtual void sendTextAsCharVector(std::unique_ptr<Vector<char>>) = 0; | 80 virtual void sendTextAsCharVector(PassOwnPtr<Vector<char>>) = 0; |
82 virtual void sendBinaryAsCharVector(std::unique_ptr<Vector<char>>) = 0; | 81 virtual void sendBinaryAsCharVector(PassOwnPtr<Vector<char>>) = 0; |
83 | 82 |
84 // Do not call |send| after calling this method. | 83 // Do not call |send| after calling this method. |
85 virtual void close(int code, const String& reason) = 0; | 84 virtual void close(int code, const String& reason) = 0; |
86 | 85 |
87 // Log the reason text and close the connection. Will call didClose(). | 86 // Log the reason text and close the connection. Will call didClose(). |
88 // The MessageLevel parameter will be used for the level of the message | 87 // The MessageLevel parameter will be used for the level of the message |
89 // shown at the devtools console. | 88 // shown at the devtools console. |
90 // SourceLocation parameter may be shown with the reason text | 89 // SourceLocation parameter may be shown with the reason text |
91 // at the devtools console. Even if location is specified, it may be ignored | 90 // at the devtools console. Even if location is specified, it may be ignored |
92 // and the "current" location in the sense of JavaScript execution | 91 // and the "current" location in the sense of JavaScript execution |
93 // may be shown if this method is called in a JS execution context. | 92 // may be shown if this method is called in a JS execution context. |
94 // Location should not be null. | 93 // Location should not be null. |
95 virtual void fail(const String& reason, MessageLevel, std::unique_ptr<Source
Location>) = 0; | 94 virtual void fail(const String& reason, MessageLevel, PassOwnPtr<SourceLocat
ion>) = 0; |
96 | 95 |
97 // Do not call any methods after calling this method. | 96 // Do not call any methods after calling this method. |
98 virtual void disconnect() = 0; // Will suppress didClose(). | 97 virtual void disconnect() = 0; // Will suppress didClose(). |
99 | 98 |
100 virtual ~WebSocketChannel() { } | 99 virtual ~WebSocketChannel() { } |
101 | 100 |
102 DEFINE_INLINE_VIRTUAL_TRACE() { } | 101 DEFINE_INLINE_VIRTUAL_TRACE() { } |
103 }; | 102 }; |
104 | 103 |
105 } // namespace blink | 104 } // namespace blink |
106 | 105 |
107 #endif // WebSocketChannel_h | 106 #endif // WebSocketChannel_h |
OLD | NEW |