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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: Source/modules/websockets/WebSocketChannel.h
diff --git a/Source/modules/websockets/WebSocketChannel.h b/Source/modules/websockets/WebSocketChannel.h
index 49f14bfadf204d1c93fdb62b7f01f7169f054777..8276dc4a6a493f27f3d75358735bc5e0dd76620f 100644
--- a/Source/modules/websockets/WebSocketChannel.h
+++ b/Source/modules/websockets/WebSocketChannel.h
@@ -31,9 +31,14 @@
#ifndef WebSocketChannel_h
#define WebSocketChannel_h
+#include "core/inspector/ScriptCallFrame.h"
+#include "core/inspector/ScriptCallStack.h"
+#include "core/page/ConsoleTypes.h"
#include "wtf/Forward.h"
#include "wtf/Noncopyable.h"
+#include "wtf/PassOwnPtr.h"
#include "wtf/PassRefPtr.h"
+#include "wtf/Vector.h"
namespace WebCore {
@@ -73,6 +78,16 @@ public:
CloseEventCodeMaximumUserDefined = 4999
};
+ // A holder class for Vector<ScriptCallFrame> for readability.
+ class CallStackWrapper {
+ public:
+ CallStackWrapper(const Vector<ScriptCallFrame>& frames): m_frames(frames) { }
+ PassRefPtr<ScriptCallStack> createCallStack() { return ScriptCallStack::create(m_frames); }
+
+ private:
+ Vector<ScriptCallFrame> m_frames;
+ };
+
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.
@@ -81,8 +96,21 @@ public:
virtual SendResult send(const Blob&) = 0;
virtual unsigned long bufferedAmount() const = 0;
virtual void close(int code, const String& reason) = 0;
+
// Log the reason text and close the connection. Will call didClose().
- virtual void fail(const String& reason) = 0;
+ // The MessageLevel parameter will be used for the level of the message
+ // shown at the devtool console. The CallStackWrapper parameter is
+ // callstack information. it may be shown with the reason text at the
+ // devtool console. If the parameter is null, the instance may fill
+ // the callstack information and show it with the reason text if possible.
+ virtual void fail(const String& reason, MessageLevel, PassOwnPtr<CallStackWrapper>) = 0;
+
+ // Log the reason text and close the connection. Will call didClose().
+ // The MessageLevel parameter will be used for the level of the message
+ // shown at the devtool console. The instance may fill the callstack
+ // information and show it with the reason text if possible.
+ virtual void fail(const String& reason, MessageLevel) = 0;
+
virtual void disconnect() = 0; // Will suppress didClose().
virtual void suspend() = 0;
« no previous file with comments | « Source/modules/websockets/WebSocket.cpp ('k') | Source/modules/websockets/WorkerThreadableWebSocketChannel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698