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> |
40 | 41 |
41 namespace blink { | 42 namespace blink { |
42 | 43 |
43 class BlobDataHandle; | 44 class BlobDataHandle; |
44 class DOMArrayBuffer; | 45 class DOMArrayBuffer; |
45 class ExecutionContext; | 46 class ExecutionContext; |
46 class KURL; | 47 class KURL; |
47 class WebSocketChannelClient; | 48 class WebSocketChannelClient; |
48 | 49 |
49 class MODULES_EXPORT WebSocketChannel : public GarbageCollectedFinalized<WebSock
etChannel> { | 50 class MODULES_EXPORT WebSocketChannel : public GarbageCollectedFinalized<WebSock
etChannel> { |
(...skipping 20 matching lines...) Expand all Loading... |
70 CloseEventCodeMinimumUserDefined = 3000, | 71 CloseEventCodeMinimumUserDefined = 3000, |
71 CloseEventCodeMaximumUserDefined = 4999 | 72 CloseEventCodeMaximumUserDefined = 4999 |
72 }; | 73 }; |
73 | 74 |
74 virtual bool connect(const KURL&, const String& protocol) = 0; | 75 virtual bool connect(const KURL&, const String& protocol) = 0; |
75 virtual void send(const CString&) = 0; | 76 virtual void send(const CString&) = 0; |
76 virtual void send(const DOMArrayBuffer&, unsigned byteOffset, unsigned byteL
ength) = 0; | 77 virtual void send(const DOMArrayBuffer&, unsigned byteOffset, unsigned byteL
ength) = 0; |
77 virtual void send(PassRefPtr<BlobDataHandle>) = 0; | 78 virtual void send(PassRefPtr<BlobDataHandle>) = 0; |
78 | 79 |
79 // For WorkerWebSocketChannel. | 80 // For WorkerWebSocketChannel. |
80 virtual void sendTextAsCharVector(PassOwnPtr<Vector<char>>) = 0; | 81 virtual void sendTextAsCharVector(std::unique_ptr<Vector<char>>) = 0; |
81 virtual void sendBinaryAsCharVector(PassOwnPtr<Vector<char>>) = 0; | 82 virtual void sendBinaryAsCharVector(std::unique_ptr<Vector<char>>) = 0; |
82 | 83 |
83 // Do not call |send| after calling this method. | 84 // Do not call |send| after calling this method. |
84 virtual void close(int code, const String& reason) = 0; | 85 virtual void close(int code, const String& reason) = 0; |
85 | 86 |
86 // Log the reason text and close the connection. Will call didClose(). | 87 // Log the reason text and close the connection. Will call didClose(). |
87 // The MessageLevel parameter will be used for the level of the message | 88 // The MessageLevel parameter will be used for the level of the message |
88 // shown at the devtools console. | 89 // shown at the devtools console. |
89 // SourceLocation parameter may be shown with the reason text | 90 // SourceLocation parameter may be shown with the reason text |
90 // at the devtools console. Even if location is specified, it may be ignored | 91 // at the devtools console. Even if location is specified, it may be ignored |
91 // and the "current" location in the sense of JavaScript execution | 92 // and the "current" location in the sense of JavaScript execution |
92 // may be shown if this method is called in a JS execution context. | 93 // may be shown if this method is called in a JS execution context. |
93 // Location should not be null. | 94 // Location should not be null. |
94 virtual void fail(const String& reason, MessageLevel, PassOwnPtr<SourceLocat
ion>) = 0; | 95 virtual void fail(const String& reason, MessageLevel, std::unique_ptr<Source
Location>) = 0; |
95 | 96 |
96 // Do not call any methods after calling this method. | 97 // Do not call any methods after calling this method. |
97 virtual void disconnect() = 0; // Will suppress didClose(). | 98 virtual void disconnect() = 0; // Will suppress didClose(). |
98 | 99 |
99 virtual ~WebSocketChannel() { } | 100 virtual ~WebSocketChannel() { } |
100 | 101 |
101 DEFINE_INLINE_VIRTUAL_TRACE() { } | 102 DEFINE_INLINE_VIRTUAL_TRACE() { } |
102 }; | 103 }; |
103 | 104 |
104 } // namespace blink | 105 } // namespace blink |
105 | 106 |
106 #endif // WebSocketChannel_h | 107 #endif // WebSocketChannel_h |
OLD | NEW |