summaryrefslogtreecommitdiffstats
path: root/webkit/glue/websocketstreamhandle_impl.cc
diff options
context:
space:
mode:
authorukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-22 11:35:43 +0000
committerukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-22 11:35:43 +0000
commit04be4b58872f706194c3a126aec973ec53897366 (patch)
tree6e9b2fa5f60413eaa514523089d7e46cc87c2b32 /webkit/glue/websocketstreamhandle_impl.cc
parentf1869fdc0e8e49022ab4593eeba25fcb51f83ac1 (diff)
downloadchromium_src-04be4b58872f706194c3a126aec973ec53897366.zip
chromium_src-04be4b58872f706194c3a126aec973ec53897366.tar.gz
chromium_src-04be4b58872f706194c3a126aec973ec53897366.tar.bz2
Make WebSocketStreamHandleBridge RefCountedThreadSafe.
In layout_tests, test_shell crashed by /base/ref_counted.cc(60)] Check failed: in_dtor_. RefCountedThreadSafe object deleted without calling Release() in context of test_shell(webkit_glue::WebSocketStreamHandleImpl::Context::DidClose(WebKit::WebSocketStreamHandle*)+0x7d) [0x8f6b34b] Since bridge instance is ref counted object, we must not delete it. Make base class WebSocketStreamHandleBridge RefCountedThreadSafe, and manage it by scoped_refptr. BUG=25399 TEST=layout tests not crashed in XHR tests. Review URL: http://codereview.chromium.org/316008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29769 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/websocketstreamhandle_impl.cc')
-rw-r--r--webkit/glue/websocketstreamhandle_impl.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/webkit/glue/websocketstreamhandle_impl.cc b/webkit/glue/websocketstreamhandle_impl.cc
index 48cdeea..5952850 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;