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

Unified Diff: content/browser/websockets/websocket_handshake_request_info_impl.cc

Issue 2397393002: Provide child/frame IDs for WebSocket handshake request (Closed)
Patch Set: fix Created 4 years, 2 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: content/browser/websockets/websocket_handshake_request_info_impl.cc
diff --git a/content/browser/websockets/websocket_handshake_request_info_impl.cc b/content/browser/websockets/websocket_handshake_request_info_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..14bb5cb184b011dc9b957dacf589722809afb9a3
--- /dev/null
+++ b/content/browser/websockets/websocket_handshake_request_info_impl.cc
@@ -0,0 +1,46 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/websockets/websocket_handshake_request_info_impl.h"
+
+#include "net/url_request/url_request.h"
+
+namespace content {
+
+namespace {
+
+constexpr int g_tag = 0;
+
+} // namesapce
+
+WebSocketHandshakeRequestInfoImpl::WebSocketHandshakeRequestInfoImpl(
+ int child_id,
+ int render_frame_id)
+ : child_id_(child_id), render_frame_id_(render_frame_id) {}
+
+WebSocketHandshakeRequestInfoImpl::~WebSocketHandshakeRequestInfoImpl() {}
+
+void WebSocketHandshakeRequestInfoImpl::CreateInfoAndAssociateWithRequest(
+ int child_id,
+ int render_frame_id,
+ net::URLRequest* request) {
+ request->SetUserData(
+ &g_tag, new WebSocketHandshakeRequestInfoImpl(child_id, render_frame_id));
+}
+
+int WebSocketHandshakeRequestInfoImpl::GetChildId() const {
+ return child_id_;
+}
+
+int WebSocketHandshakeRequestInfoImpl::GetRenderFrameId() const {
+ return render_frame_id_;
+}
+
+const WebSocketHandshakeRequestInfo* WebSocketHandshakeRequestInfo::ForRequest(
+ const net::URLRequest* request) {
+ return static_cast<WebSocketHandshakeRequestInfoImpl*>(
+ request->GetUserData(&g_tag));
+}
+
+} // namespace content
« no previous file with comments | « content/browser/websockets/websocket_handshake_request_info_impl.h ('k') | content/browser/websockets/websocket_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698