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

Unified Diff: webkit/glue/websocketstreamhandle_impl.cc

Issue 316008: Make WebSocketStreamHandleBridge RefCountedThreadSafe. (Closed)
Patch Set: Created 11 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
« no previous file with comments | « webkit/glue/websocketstreamhandle_bridge.h ('k') | webkit/tools/test_shell/simple_socket_stream_bridge.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/websocketstreamhandle_impl.cc
diff --git a/webkit/glue/websocketstreamhandle_impl.cc b/webkit/glue/websocketstreamhandle_impl.cc
index 48cdeea984b1261930d0216f28fd29ffb37e102d..5952850dc842048e2656adf506b20746d8f1538d 100644
--- a/webkit/glue/websocketstreamhandle_impl.cc
+++ b/webkit/glue/websocketstreamhandle_impl.cc
@@ -61,7 +61,7 @@ class WebSocketStreamHandleImpl::Context
WebKit::WebSocketStreamHandleClient* client_;
// |bridge_| is alive from Connect to DidClose, so Context must be alive
// in the time period.
- WebSocketStreamHandleBridge* bridge_;
+ scoped_refptr<WebSocketStreamHandleBridge> bridge_;
DISALLOW_COPY_AND_ASSIGN(Context);
};
@@ -97,8 +97,8 @@ void WebSocketStreamHandleImpl::Context::Detach() {
handle_ = NULL;
client_ = NULL;
// If Connect was called, |bridge_| is not NULL, so that this Context closes
- // the |bridge_| here. Then |bridge_| will call back DidClose, in which
- // this Context will delete the |bridge_|.
+ // the |bridge_| here. Then |bridge_| will call back DidClose, and will
+ // be released by itself.
// Otherwise, |bridge_| is NULL.
if (bridge_)
bridge_->Close();
@@ -133,7 +133,6 @@ void WebSocketStreamHandleImpl::Context::DidReceiveData(
void WebSocketStreamHandleImpl::Context::DidClose(
WebKit::WebSocketStreamHandle* web_handle) {
LOG(INFO) << "DidClose";
- delete bridge_;
bridge_ = NULL;
WebSocketStreamHandleImpl* handle = handle_;
handle_ = NULL;
« no previous file with comments | « webkit/glue/websocketstreamhandle_bridge.h ('k') | webkit/tools/test_shell/simple_socket_stream_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698