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

Side by Side Diff: net/websockets/websocket_job.cc

Issue 8491043: Allow linker initialization of lazy instance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: willchan comments + 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 | « net/url_request/url_request_test_job.cc ('k') | printing/backend/print_backend_cups.cc » ('j') | 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 "net/websockets/websocket_job.h" 5 #include "net/websockets/websocket_job.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 class WebSocketJobInitSingleton { 47 class WebSocketJobInitSingleton {
48 private: 48 private:
49 friend struct base::DefaultLazyInstanceTraits<WebSocketJobInitSingleton>; 49 friend struct base::DefaultLazyInstanceTraits<WebSocketJobInitSingleton>;
50 WebSocketJobInitSingleton() { 50 WebSocketJobInitSingleton() {
51 net::SocketStreamJob::RegisterProtocolFactory("ws", WebSocketJobFactory); 51 net::SocketStreamJob::RegisterProtocolFactory("ws", WebSocketJobFactory);
52 net::SocketStreamJob::RegisterProtocolFactory("wss", WebSocketJobFactory); 52 net::SocketStreamJob::RegisterProtocolFactory("wss", WebSocketJobFactory);
53 } 53 }
54 }; 54 };
55 55
56 static base::LazyInstance<WebSocketJobInitSingleton> g_websocket_job_init( 56 static base::LazyInstance<WebSocketJobInitSingleton> g_websocket_job_init =
57 base::LINKER_INITIALIZED); 57 LAZY_INSTANCE_INITIALIZER;
58 58
59 } // anonymous namespace 59 } // anonymous namespace
60 60
61 namespace net { 61 namespace net {
62 62
63 bool WebSocketJob::websocket_over_spdy_enabled_ = false; 63 bool WebSocketJob::websocket_over_spdy_enabled_ = false;
64 64
65 // static 65 // static
66 void WebSocketJob::EnsureInit() { 66 void WebSocketJob::EnsureInit() {
67 g_websocket_job_init.Get(); 67 g_websocket_job_init.Get();
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 CloseInternal(); 664 CloseInternal();
665 return; 665 return;
666 } 666 }
667 current_buffer_ = new DrainableIOBuffer( 667 current_buffer_ = new DrainableIOBuffer(
668 send_frame_handler_->GetCurrentBuffer(), 668 send_frame_handler_->GetCurrentBuffer(),
669 send_frame_handler_->GetCurrentBufferSize()); 669 send_frame_handler_->GetCurrentBufferSize());
670 SendDataInternal(current_buffer_->data(), current_buffer_->BytesRemaining()); 670 SendDataInternal(current_buffer_->data(), current_buffer_->BytesRemaining());
671 } 671 }
672 672
673 } // namespace net 673 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_test_job.cc ('k') | printing/backend/print_backend_cups.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698