Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: Source/modules/websockets/WebSocketChannel.h

Issue 14657008: Make websocket error messages look better at the devtools console. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef WebSocketChannel_h 31 #ifndef WebSocketChannel_h
32 #define WebSocketChannel_h 32 #define WebSocketChannel_h
33 33
34 #include "core/inspector/ScriptCallFrame.h"
35 #include "core/inspector/ScriptCallStack.h"
36 #include "core/page/ConsoleTypes.h"
34 #include "wtf/Forward.h" 37 #include "wtf/Forward.h"
35 #include "wtf/Noncopyable.h" 38 #include "wtf/Noncopyable.h"
39 #include "wtf/PassOwnPtr.h"
36 #include "wtf/PassRefPtr.h" 40 #include "wtf/PassRefPtr.h"
41 #include "wtf/Vector.h"
37 42
38 namespace WebCore { 43 namespace WebCore {
39 44
40 class Blob; 45 class Blob;
41 class KURL; 46 class KURL;
42 class ScriptExecutionContext; 47 class ScriptExecutionContext;
43 class WebSocketChannelClient; 48 class WebSocketChannelClient;
44 49
45 class WebSocketChannel { 50 class WebSocketChannel {
46 WTF_MAKE_NONCOPYABLE(WebSocketChannel); 51 WTF_MAKE_NONCOPYABLE(WebSocketChannel);
(...skipping 18 matching lines...) Expand all
65 CloseEventCodeAbnormalClosure = 1006, 70 CloseEventCodeAbnormalClosure = 1006,
66 CloseEventCodeInvalidFramePayloadData = 1007, 71 CloseEventCodeInvalidFramePayloadData = 1007,
67 CloseEventCodePolicyViolation = 1008, 72 CloseEventCodePolicyViolation = 1008,
68 CloseEventCodeMessageTooBig = 1009, 73 CloseEventCodeMessageTooBig = 1009,
69 CloseEventCodeMandatoryExt = 1010, 74 CloseEventCodeMandatoryExt = 1010,
70 CloseEventCodeInternalError = 1011, 75 CloseEventCodeInternalError = 1011,
71 CloseEventCodeTLSHandshake = 1015, 76 CloseEventCodeTLSHandshake = 1015,
72 CloseEventCodeMinimumUserDefined = 3000, 77 CloseEventCodeMinimumUserDefined = 3000,
73 CloseEventCodeMaximumUserDefined = 4999 78 CloseEventCodeMaximumUserDefined = 4999
74 }; 79 };
75 80
tyoshino (SeeGerritForStatus) 2013/05/01 11:41:52 // A holder class for Vector<ScriptCallFrame> for
yhirano 2013/05/02 02:04:58 Done.
81 class CallStackWrapper {
82 public:
83 CallStackWrapper(const Vector<ScriptCallFrame>& frames): m_frames(frames ) { }
84 PassRefPtr<ScriptCallStack> callStack() { return ScriptCallStack::create (m_frames); }
85
86 private:
87 Vector<ScriptCallFrame> m_frames;
88 };
89
76 virtual void connect(const KURL&, const String& protocol) = 0; 90 virtual void connect(const KURL&, const String& protocol) = 0;
77 virtual String subprotocol() = 0; // Will be available after didConnect() ca llback is invoked. 91 virtual String subprotocol() = 0; // Will be available after didConnect() ca llback is invoked.
78 virtual String extensions() = 0; // Will be available after didConnect() cal lback is invoked. 92 virtual String extensions() = 0; // Will be available after didConnect() cal lback is invoked.
79 virtual SendResult send(const String& message) = 0; 93 virtual SendResult send(const String& message) = 0;
80 virtual SendResult send(const ArrayBuffer&, unsigned byteOffset, unsigned by teLength) = 0; 94 virtual SendResult send(const ArrayBuffer&, unsigned byteOffset, unsigned by teLength) = 0;
81 virtual SendResult send(const Blob&) = 0; 95 virtual SendResult send(const Blob&) = 0;
82 virtual unsigned long bufferedAmount() const = 0; 96 virtual unsigned long bufferedAmount() const = 0;
83 virtual void close(int code, const String& reason) = 0; 97 virtual void close(int code, const String& reason) = 0;
98
84 // Log the reason text and close the connection. Will call didClose(). 99 // Log the reason text and close the connection. Will call didClose().
85 virtual void fail(const String& reason) = 0; 100 // The MessageLevel parameter will be used for the level of the message show n at the devtool console.
101 // The CallStackWrapper parameter is callstack information. it may be shown with the reason text at the devtool console.
102 // If the parameter is null, the instance may fill the callstack information and show it with the reason text if possible.
103 virtual void fail(const String& reason, MessageLevel, PassOwnPtr<CallStackWr apper>) = 0;
104
105 // Log the reason text and close the connection. Will call didClose().
106 // The MessageLevel parameter will be used for the level of the message show n at the devtool console.
107 // The instance may fill the callstack information and show it with the reas on text if possible.
108 virtual void fail(const String& reason, MessageLevel) = 0;
109
86 virtual void disconnect() = 0; // Will suppress didClose(). 110 virtual void disconnect() = 0; // Will suppress didClose().
87 111
88 virtual void suspend() = 0; 112 virtual void suspend() = 0;
89 virtual void resume() = 0; 113 virtual void resume() = 0;
90 114
91 void ref() { refWebSocketChannel(); } 115 void ref() { refWebSocketChannel(); }
92 void deref() { derefWebSocketChannel(); } 116 void deref() { derefWebSocketChannel(); }
93 117
94 protected: 118 protected:
95 virtual ~WebSocketChannel() { } 119 virtual ~WebSocketChannel() { }
96 virtual void refWebSocketChannel() = 0; 120 virtual void refWebSocketChannel() = 0;
97 virtual void derefWebSocketChannel() = 0; 121 virtual void derefWebSocketChannel() = 0;
98 }; 122 };
99 123
100 } // namespace WebCore 124 } // namespace WebCore
101 125
102 #endif // WebSocketChannel_h 126 #endif // WebSocketChannel_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698