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

Side by Side Diff: content/browser/browser_main_loop.cc

Issue 250723002: content: Terminate early if the toolkit initialization fails. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 7 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 | « content/browser/browser_main_loop.h ('k') | content/browser/browser_main_runner.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) 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/file_util.h" 10 #include "base/file_util.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 #include "content/browser/zygote_host/zygote_host_impl_linux.h" 108 #include "content/browser/zygote_host/zygote_host_impl_linux.h"
109 #include "sandbox/linux/suid/client/setuid_sandbox_client.h" 109 #include "sandbox/linux/suid/client/setuid_sandbox_client.h"
110 #endif 110 #endif
111 111
112 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) 112 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED)
113 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" 113 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h"
114 #endif 114 #endif
115 115
116 #if defined(USE_X11) 116 #if defined(USE_X11)
117 #include "ui/gfx/x/x11_connection.h" 117 #include "ui/gfx/x/x11_connection.h"
118 #include "ui/gfx/x/x11_types.h"
118 #endif 119 #endif
119 120
120 #if defined(USE_OZONE) 121 #if defined(USE_OZONE)
121 #include "ui/ozone/ozone_platform.h" 122 #include "ui/ozone/ozone_platform.h"
122 #include "ui/events/ozone/event_factory_ozone.h" 123 #include "ui/events/ozone/event_factory_ozone.h"
123 #endif 124 #endif
124 125
125 // One of the linux specific headers defines this as a macro. 126 // One of the linux specific headers defines this as a macro.
126 #ifdef DestroyAll 127 #ifdef DestroyAll
127 #undef DestroyAll 128 #undef DestroyAll
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 } 1017 }
1017 1018
1018 #if defined(OS_MACOSX) 1019 #if defined(OS_MACOSX)
1019 ThemeHelperMac::GetInstance(); 1020 ThemeHelperMac::GetInstance();
1020 #endif 1021 #endif
1021 #endif // !defined(OS_IOS) 1022 #endif // !defined(OS_IOS)
1022 1023
1023 return result_code_; 1024 return result_code_;
1024 } 1025 }
1025 1026
1026 void BrowserMainLoop::InitializeToolkit() { 1027 bool BrowserMainLoop::InitializeToolkit() {
1027 TRACE_EVENT0("startup", "BrowserMainLoop::InitializeToolkit") 1028 TRACE_EVENT0("startup", "BrowserMainLoop::InitializeToolkit")
1028 // TODO(evan): this function is rather subtle, due to the variety 1029 // TODO(evan): this function is rather subtle, due to the variety
1029 // of intersecting ifdefs we have. To keep it easy to follow, there 1030 // of intersecting ifdefs we have. To keep it easy to follow, there
1030 // are no #else branches on any #ifs. 1031 // are no #else branches on any #ifs.
1031 // TODO(stevenjb): Move platform specific code into platform specific Parts 1032 // TODO(stevenjb): Move platform specific code into platform specific Parts
1032 // (Need to add InitializeToolkit stage to BrowserParts). 1033 // (Need to add InitializeToolkit stage to BrowserParts).
1033 // See also GTK setup in EarlyInitialization, above, and associated comments. 1034 // See also GTK setup in EarlyInitialization, above, and associated comments.
1034 1035
1035 #if defined(TOOLKIT_GTK) 1036 #if defined(TOOLKIT_GTK)
1036 // It is important for this to happen before the first run dialog, as it 1037 // It is important for this to happen before the first run dialog, as it
1037 // styles the dialog as well. 1038 // styles the dialog as well.
1038 gfx::InitRCStyles(); 1039 gfx::InitRCStyles();
1039 #endif 1040 #endif
1040 1041
1041 #if defined(OS_WIN) 1042 #if defined(OS_WIN)
1042 // Init common control sex. 1043 // Init common control sex.
1043 INITCOMMONCONTROLSEX config; 1044 INITCOMMONCONTROLSEX config;
1044 config.dwSize = sizeof(config); 1045 config.dwSize = sizeof(config);
1045 config.dwICC = ICC_WIN95_CLASSES; 1046 config.dwICC = ICC_WIN95_CLASSES;
1046 if (!InitCommonControlsEx(&config)) 1047 if (!InitCommonControlsEx(&config))
1047 LOG_GETLASTERROR(FATAL); 1048 LOG_GETLASTERROR(FATAL);
1048 #endif 1049 #endif
1049 1050
1050 #if defined(USE_AURA) 1051 #if defined(USE_AURA)
1052
1053 #if defined(USE_X11)
1054 if (!gfx::GetXDisplay())
1055 return false;
1056 #endif
1057
1051 // Env creates the compositor. Aura widgets need the compositor to be created 1058 // Env creates the compositor. Aura widgets need the compositor to be created
1052 // before they can be initialized by the browser. 1059 // before they can be initialized by the browser.
1053 aura::Env::CreateInstance(); 1060 aura::Env::CreateInstance();
1054 #endif 1061 #endif // defined(USE_AURA)
1055 1062
1056 if (parts_) 1063 if (parts_)
1057 parts_->ToolkitInitialized(); 1064 parts_->ToolkitInitialized();
1065
1066 return true;
1058 } 1067 }
1059 1068
1060 void BrowserMainLoop::MainMessageLoopRun() { 1069 void BrowserMainLoop::MainMessageLoopRun() {
1061 #if defined(OS_ANDROID) 1070 #if defined(OS_ANDROID)
1062 // Android's main message loop is the Java message loop. 1071 // Android's main message loop is the Java message loop.
1063 NOTREACHED(); 1072 NOTREACHED();
1064 #else 1073 #else
1065 DCHECK(base::MessageLoopForUI::IsCurrent()); 1074 DCHECK(base::MessageLoopForUI::IsCurrent());
1066 if (parameters_.ui_task) 1075 if (parameters_.ui_task)
1067 base::MessageLoopForUI::current()->PostTask(FROM_HERE, 1076 base::MessageLoopForUI::current()->PostTask(FROM_HERE,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 base::TimeDelta::FromSeconds(delay_secs)); 1117 base::TimeDelta::FromSeconds(delay_secs));
1109 } 1118 }
1110 1119
1111 void BrowserMainLoop::EndStartupTracing(const base::FilePath& trace_file) { 1120 void BrowserMainLoop::EndStartupTracing(const base::FilePath& trace_file) {
1112 is_tracing_startup_ = false; 1121 is_tracing_startup_ = false;
1113 TracingController::GetInstance()->DisableRecording( 1122 TracingController::GetInstance()->DisableRecording(
1114 trace_file, base::Bind(&OnStoppedStartupTracing)); 1123 trace_file, base::Bind(&OnStoppedStartupTracing));
1115 } 1124 }
1116 1125
1117 } // namespace content 1126 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_main_loop.h ('k') | content/browser/browser_main_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698