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

Side by Side Diff: net/http/http_network_layer.cc

Issue 11572039: Make HttpNetworkLayer subscribe to power events on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Handle case where SystemMonitor::Get() returns NULL Created 7 years, 12 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/http/http_network_layer.h ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/http/http_network_layer.h" 5 #include "net/http/http_network_layer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "base/string_split.h" 9 #include "base/string_split.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "net/http/http_network_session.h" 11 #include "net/http/http_network_session.h"
12 #include "net/http/http_network_transaction.h" 12 #include "net/http/http_network_transaction.h"
13 #include "net/http/http_server_properties_impl.h" 13 #include "net/http/http_server_properties_impl.h"
14 #include "net/http/http_stream_factory_impl_job.h" 14 #include "net/http/http_stream_factory_impl_job.h"
15 #include "net/spdy/spdy_framer.h" 15 #include "net/spdy/spdy_framer.h"
16 #include "net/spdy/spdy_session.h" 16 #include "net/spdy/spdy_session.h"
17 #include "net/spdy/spdy_session_pool.h" 17 #include "net/spdy/spdy_session_pool.h"
18 18
19 namespace net { 19 namespace net {
20 20
21 //----------------------------------------------------------------------------- 21 //-----------------------------------------------------------------------------
22 HttpNetworkLayer::HttpNetworkLayer(HttpNetworkSession* session) 22 HttpNetworkLayer::HttpNetworkLayer(HttpNetworkSession* session)
23 : session_(session), 23 : session_(session),
24 suspended_(false) { 24 suspended_(false) {
25 DCHECK(session_.get()); 25 DCHECK(session_.get());
26 #if defined(OS_WIN)
27 base::SystemMonitor* system_monitor = base::SystemMonitor::Get();
28 if (system_monitor)
29 system_monitor->AddPowerObserver(this);
30 #endif
26 } 31 }
27 32
28 HttpNetworkLayer::~HttpNetworkLayer() { 33 HttpNetworkLayer::~HttpNetworkLayer() {
34 #if defined(OS_WIN)
35 base::SystemMonitor* system_monitor = base::SystemMonitor::Get();
36 if (system_monitor)
37 system_monitor->RemovePowerObserver(this);
38 #endif
29 } 39 }
30 40
31 //----------------------------------------------------------------------------- 41 //-----------------------------------------------------------------------------
32 42
33 // static 43 // static
34 HttpTransactionFactory* HttpNetworkLayer::CreateFactory( 44 HttpTransactionFactory* HttpNetworkLayer::CreateFactory(
35 HttpNetworkSession* session) { 45 HttpNetworkSession* session) {
36 DCHECK(session); 46 DCHECK(session);
37 47
38 return new HttpNetworkLayer(session); 48 return new HttpNetworkLayer(session);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 80
71 if (session_) 81 if (session_)
72 session_->CloseIdleConnections(); 82 session_->CloseIdleConnections();
73 } 83 }
74 84
75 void HttpNetworkLayer::OnResume() { 85 void HttpNetworkLayer::OnResume() {
76 suspended_ = false; 86 suspended_ = false;
77 } 87 }
78 88
79 } // namespace net 89 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_network_layer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698