OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |