OLD | NEW |
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/browser/browser_main_loop.h" | 5 #include "content/browser/browser_main_loop.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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 // One of the linux specific headers defines this as a macro. | 79 // One of the linux specific headers defines this as a macro. |
80 #ifdef DestroyAll | 80 #ifdef DestroyAll |
81 #undef DestroyAll | 81 #undef DestroyAll |
82 #endif | 82 #endif |
83 | 83 |
84 using content::TraceControllerImpl; | 84 using content::TraceControllerImpl; |
85 | 85 |
86 namespace { | 86 namespace { |
87 | 87 |
88 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 88 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
89 void SetupSandbox(const CommandLine& parsed_command_line) { | 89 void SetupSandbox(const CommandLine& parsed_command_line) { |
90 // TODO(evanm): move this into SandboxWrapper; I'm just trying to move this | 90 // TODO(evanm): move this into SandboxWrapper; I'm just trying to move this |
91 // code en masse out of chrome_main for now. | 91 // code en masse out of chrome_main for now. |
92 const char* sandbox_binary = NULL; | 92 const char* sandbox_binary = NULL; |
93 struct stat st; | 93 struct stat st; |
94 | 94 |
95 // In Chromium branded builds, developers can set an environment variable to | 95 // In Chromium branded builds, developers can set an environment variable to |
96 // use the development sandbox. See | 96 // use the development sandbox. See |
97 // http://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment | 97 // http://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment |
98 if (stat("/proc/self/exe", &st) == 0 && st.st_uid == getuid()) | 98 if (stat("/proc/self/exe", &st) == 0 && st.st_uid == getuid()) |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 UMA_HISTOGRAM_BOOLEAN("Chrome.CommandLineUseSystemSSL", !init_nspr); | 259 UMA_HISTOGRAM_BOOLEAN("Chrome.CommandLineUseSystemSSL", !init_nspr); |
260 #elif defined(USE_NSS) | 260 #elif defined(USE_NSS) |
261 init_nspr = true; | 261 init_nspr = true; |
262 #endif | 262 #endif |
263 if (init_nspr) { | 263 if (init_nspr) { |
264 // We want to be sure to init NSPR on the main thread. | 264 // We want to be sure to init NSPR on the main thread. |
265 crypto::EnsureNSPRInit(); | 265 crypto::EnsureNSPRInit(); |
266 } | 266 } |
267 #endif // !defined(USE_OPENSSL) | 267 #endif // !defined(USE_OPENSSL) |
268 | 268 |
269 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 269 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
270 SetupSandbox(parsed_command_line_); | 270 SetupSandbox(parsed_command_line_); |
271 #endif | 271 #endif |
272 | 272 |
273 if (parsed_command_line_.HasSwitch(switches::kEnableSSLCachedInfo)) | 273 if (parsed_command_line_.HasSwitch(switches::kEnableSSLCachedInfo)) |
274 net::SSLConfigService::EnableCachedInfo(); | 274 net::SSLConfigService::EnableCachedInfo(); |
275 | 275 |
276 // TODO(abarth): Should this move to InitializeNetworkOptions? This doesn't | 276 // TODO(abarth): Should this move to InitializeNetworkOptions? This doesn't |
277 // seem dependent on SSL initialization(). | 277 // seem dependent on SSL initialization(). |
278 if (parsed_command_line_.HasSwitch(switches::kEnableTcpFastOpen)) | 278 if (parsed_command_line_.HasSwitch(switches::kEnableTcpFastOpen)) |
279 net::set_tcp_fastopen_enabled(true); | 279 net::set_tcp_fastopen_enabled(true); |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 if (parts_.get()) | 631 if (parts_.get()) |
632 parts_->ToolkitInitialized(); | 632 parts_->ToolkitInitialized(); |
633 } | 633 } |
634 | 634 |
635 void BrowserMainLoop::MainMessageLoopRun() { | 635 void BrowserMainLoop::MainMessageLoopRun() { |
636 if (parameters_.ui_task) | 636 if (parameters_.ui_task) |
637 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); | 637 MessageLoopForUI::current()->PostTask(FROM_HERE, *parameters_.ui_task); |
638 | 638 |
639 #if defined(OS_MACOSX) | 639 #if defined(OS_MACOSX) |
640 MessageLoopForUI::current()->Run(); | 640 MessageLoopForUI::current()->Run(); |
| 641 #elif defined(OS_ANDROID) |
| 642 // Android's main message loop is the Java message loop. |
| 643 NOTREACHED(); |
641 #else | 644 #else |
642 MessageLoopForUI::current()->RunWithDispatcher(NULL); | 645 MessageLoopForUI::current()->RunWithDispatcher(NULL); |
643 #endif | 646 #endif |
644 } | 647 } |
645 | 648 |
646 } // namespace content | 649 } // namespace content |
OLD | NEW |