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

Unified Diff: third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp

Issue 2652973002: [scheduler] Plumb websocket information to scheduler (Closed)
Patch Set: git Created 3 years, 10 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: third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp
diff --git a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp
index 2e9effb279e86e68e638c42581dd6ae3b2d6f1de..2d0242d0a331b7998ee45e2f4a90fef6a86dae27 100644
--- a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp
+++ b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp
@@ -30,6 +30,7 @@
#include "modules/websockets/DocumentWebSocketChannel.h"
+#include <memory>
#include "core/dom/DOMArrayBuffer.h"
#include "core/dom/Document.h"
#include "core/dom/ExecutionContext.h"
@@ -45,6 +46,7 @@
#include "modules/websockets/WebSocketChannelClient.h"
#include "modules/websockets/WebSocketFrame.h"
#include "modules/websockets/WebSocketHandleImpl.h"
+#include "platform/WebFrameScheduler.h"
#include "platform/loader/fetch/UniqueIdentifier.h"
#include "platform/network/NetworkLog.h"
#include "platform/network/WebSocketHandshakeRequest.h"
@@ -52,7 +54,6 @@
#include "public/platform/InterfaceProvider.h"
#include "public/platform/Platform.h"
#include "wtf/PtrUtil.h"
-#include <memory>
namespace blink {
@@ -165,6 +166,11 @@ bool DocumentWebSocketChannel::connect(const KURL& url,
ConsoleMessage::create(JSMessageSource, WarningMessageLevel, message));
}
+ if (document()->frame()) {
+ connection_handle_for_scheduler_ =
+ document()->frame()->frameScheduler()->onActiveConnectionCreated();
+ }
+
m_url = url;
Vector<String> protocols;
// Avoid placing an empty token in the Vector when the protocol string is
@@ -288,6 +294,8 @@ void DocumentWebSocketChannel::fail(const String& reason,
NETWORK_DVLOG(1) << this << " fail(" << reason << ")";
// m_handle and m_client can be null here.
+ connection_handle_for_scheduler_.reset();
+
InspectorInstrumentation::didReceiveWebSocketFrameError(document(),
m_identifier, reason);
const String message = "WebSocket connection to '" + m_url.elidedString() +
@@ -311,6 +319,7 @@ void DocumentWebSocketChannel::disconnect() {
"data", InspectorWebSocketEvent::data(document(), m_identifier));
InspectorInstrumentation::didCloseWebSocket(document(), m_identifier);
}
+ connection_handle_for_scheduler_.reset();
abortAsyncOperations();
m_handle.reset();
m_client = nullptr;
@@ -503,6 +512,8 @@ void DocumentWebSocketChannel::didFail(WebSocketHandle* handle,
NETWORK_DVLOG(1) << this << " didFail(" << handle << ", " << String(message)
<< ")";
+ connection_handle_for_scheduler_.reset();
+
DCHECK(m_handle);
DCHECK_EQ(handle, m_handle.get());
@@ -585,6 +596,8 @@ void DocumentWebSocketChannel::didClose(WebSocketHandle* handle,
NETWORK_DVLOG(1) << this << " didClose(" << handle << ", " << wasClean << ", "
<< code << ", " << String(reason) << ")";
+ connection_handle_for_scheduler_.reset();
+
DCHECK(m_handle);
DCHECK_EQ(handle, m_handle.get());

Powered by Google App Engine
This is Rietveld 408576698