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

Side by Side Diff: webkit/tools/test_shell/simple_socket_stream_bridge.cc

Issue 8524016: webkit: Remove 1 exit time destructor and turn on -Wexit-time-destructors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/support/webkit_support.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <vector> 5 #include <vector>
6 6
7 #include "webkit/tools/test_shell/simple_socket_stream_bridge.h" 7 #include "webkit/tools/test_shell/simple_socket_stream_bridge.h"
8 8
9 #include "base/atomicops.h" 9 #include "base/atomicops.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "googleurl/src/gurl.h" 13 #include "googleurl/src/gurl.h"
14 #include "net/socket_stream/socket_stream_job.h" 14 #include "net/socket_stream/socket_stream_job.h"
15 #include "net/websockets/websocket_job.h" 15 #include "net/websockets/websocket_job.h"
16 #include "net/url_request/url_request_context.h" 16 #include "net/url_request/url_request_context.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSocketStreamHandle .h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSocketStreamHandle .h"
18 #include "webkit/glue/websocketstreamhandle_bridge.h" 18 #include "webkit/glue/websocketstreamhandle_bridge.h"
19 #include "webkit/glue/websocketstreamhandle_delegate.h" 19 #include "webkit/glue/websocketstreamhandle_delegate.h"
20 20
21 using webkit_glue::WebSocketStreamHandleBridge; 21 using webkit_glue::WebSocketStreamHandleBridge;
22 22
23 static const int kNoSocketId = 0; 23 const int kNoSocketId = 0;
24 24
25 namespace { 25 namespace {
26 26
27 MessageLoop* g_io_thread; 27 MessageLoop* g_io_thread;
28 scoped_refptr<net::URLRequestContext> g_request_context; 28 net::URLRequestContext* g_request_context;
29 29
30 class WebSocketStreamHandleBridgeImpl 30 class WebSocketStreamHandleBridgeImpl
31 : public WebSocketStreamHandleBridge, 31 : public WebSocketStreamHandleBridge,
32 public net::SocketStream::Delegate { 32 public net::SocketStream::Delegate {
33 public: 33 public:
34 WebSocketStreamHandleBridgeImpl( 34 WebSocketStreamHandleBridgeImpl(
35 WebKit::WebSocketStreamHandle* handle, 35 WebKit::WebSocketStreamHandle* handle,
36 webkit_glue::WebSocketStreamHandleDelegate* delegate); 36 webkit_glue::WebSocketStreamHandleDelegate* delegate);
37 37
38 // WebSocketStreamHandleBridge methods. 38 // WebSocketStreamHandleBridge methods.
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 delegate->DidClose(handle_); 216 delegate->DidClose(handle_);
217 Release(); 217 Release();
218 } 218 }
219 219
220 } // namespace 220 } // namespace
221 221
222 /* static */ 222 /* static */
223 void SimpleSocketStreamBridge::InitializeOnIOThread( 223 void SimpleSocketStreamBridge::InitializeOnIOThread(
224 net::URLRequestContext* request_context) { 224 net::URLRequestContext* request_context) {
225 g_io_thread = MessageLoop::current(); 225 g_io_thread = MessageLoop::current();
226 g_request_context = request_context; 226 if ((g_request_context = request_context))
227 g_request_context->AddRef();
227 } 228 }
228 229
229 void SimpleSocketStreamBridge::Cleanup() { 230 void SimpleSocketStreamBridge::Cleanup() {
230 g_io_thread = NULL; 231 g_io_thread = NULL;
232 if (g_request_context)
233 g_request_context->Release();
231 g_request_context = NULL; 234 g_request_context = NULL;
232 } 235 }
233 236
234 namespace webkit_glue { 237 namespace webkit_glue {
235 238
236 /* static */ 239 /* static */
237 WebSocketStreamHandleBridge* WebSocketStreamHandleBridge::Create( 240 WebSocketStreamHandleBridge* WebSocketStreamHandleBridge::Create(
238 WebKit::WebSocketStreamHandle* handle, 241 WebKit::WebSocketStreamHandle* handle,
239 WebSocketStreamHandleDelegate* delegate) { 242 WebSocketStreamHandleDelegate* delegate) {
240 return new WebSocketStreamHandleBridgeImpl(handle, delegate); 243 return new WebSocketStreamHandleBridgeImpl(handle, delegate);
241 } 244 }
242 245
243 } // namespace webkit_glue 246 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « webkit/support/webkit_support.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698