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

Side by Side Diff: content/shell/shell_browser_main_parts.cc

Issue 10979048: Fix potential threading issues in NetworkChangeNotifierAndroid. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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
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 "content/shell/shell_browser_main_parts.h" 5 #include "content/shell/shell_browser_main_parts.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 } 82 }
83 #endif 83 #endif
84 84
85 void ShellBrowserMainParts::PostMainMessageLoopStart() { 85 void ShellBrowserMainParts::PostMainMessageLoopStart() {
86 #if defined(OS_ANDROID) 86 #if defined(OS_ANDROID)
87 MessageLoopForUI::current()->Start(); 87 MessageLoopForUI::current()->Start();
88 #endif 88 #endif
89 } 89 }
90 90
91 void ShellBrowserMainParts::PreEarlyInitialization() { 91 void ShellBrowserMainParts::PreEarlyInitialization() {
92 #if defined(OS_ANDROID)
93 net::NetworkChangeNotifier::SetFactory(
94 new net::NetworkChangeNotifierFactoryAndroid());
95 #endif
96 } 92 }
97 93
98 void ShellBrowserMainParts::PreMainMessageLoopRun() { 94 void ShellBrowserMainParts::PreMainMessageLoopRun() {
99 browser_context_.reset(new ShellBrowserContext(false)); 95 browser_context_.reset(new ShellBrowserContext(false));
100 off_the_record_browser_context_.reset(new ShellBrowserContext(true)); 96 off_the_record_browser_context_.reset(new ShellBrowserContext(true));
101 97
102 Shell::PlatformInitialize(); 98 Shell::PlatformInitialize();
103 net::NetModule::SetResourceProvider(PlatformResourceProvider); 99 net::NetModule::SetResourceProvider(PlatformResourceProvider);
100 #if defined(OS_ANDROID)
101 net::NetworkChangeNotifier::SetFactory(
102 new net::NetworkChangeNotifierFactoryAndroid(
103 MessageLoop::current()->message_loop_proxy()));
104 #endif
104 105
105 int port = 0; 106 int port = 0;
106 // On android the port number isn't used. 107 // On android the port number isn't used.
107 #if !defined(OS_ANDROID) 108 #if !defined(OS_ANDROID)
108 // See if the user specified a port on the command line (useful for 109 // See if the user specified a port on the command line (useful for
109 // automation). If not, use an ephemeral port by specifying 0. 110 // automation). If not, use an ephemeral port by specifying 0.
110 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 111 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
111 if (command_line.HasSwitch(switches::kRemoteDebuggingPort)) { 112 if (command_line.HasSwitch(switches::kRemoteDebuggingPort)) {
112 int temp_port; 113 int temp_port;
113 std::string port_str = 114 std::string port_str =
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 #if defined(USE_AURA) 147 #if defined(USE_AURA)
147 Shell::PlatformExit(); 148 Shell::PlatformExit();
148 #endif 149 #endif
149 if (devtools_delegate_) 150 if (devtools_delegate_)
150 devtools_delegate_->Stop(); 151 devtools_delegate_->Stop();
151 browser_context_.reset(); 152 browser_context_.reset();
152 off_the_record_browser_context_.reset(); 153 off_the_record_browser_context_.reset();
153 } 154 }
154 155
155 } // namespace 156 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main_android.cc ('k') | net/android/java/src/org/chromium/net/NetworkChangeNotifier.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698