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

Side by Side Diff: content/app/content_main_runner.cc

Issue 21453003: Fix content_browsertests and other full stack tests in multiple_dll (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 4 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 | « chrome_frame/chrome_frame.gyp ('k') | content/content.gyp » ('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/public/app/content_main_runner.h" 5 #include "content/public/app/content_main_runner.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include "base/allocator/allocator_extension.h" 9 #include "base/allocator/allocator_extension.h"
10 #include "base/at_exit.h" 10 #include "base/at_exit.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 NOTREACHED(); 160 NOTREACHED();
161 } 161 }
162 } 162 }
163 #endif // defined(OS_WIN) 163 #endif // defined(OS_WIN)
164 } // namespace 164 } // namespace
165 165
166 namespace content { 166 namespace content {
167 167
168 base::LazyInstance<ContentBrowserClient> 168 base::LazyInstance<ContentBrowserClient>
169 g_empty_content_browser_client = LAZY_INSTANCE_INITIALIZER; 169 g_empty_content_browser_client = LAZY_INSTANCE_INITIALIZER;
170 #if !defined(OS_IOS) && \ 170 #if !defined(OS_IOS) && !defined(CHROME_MULTIPLE_DLL_BROWSER)
171 (!defined(CHROME_MULTIPLE_DLL) || defined(CHROME_MULTIPLE_DLL_CHILD))
172 base::LazyInstance<ContentPluginClient> 171 base::LazyInstance<ContentPluginClient>
173 g_empty_content_plugin_client = LAZY_INSTANCE_INITIALIZER; 172 g_empty_content_plugin_client = LAZY_INSTANCE_INITIALIZER;
174 base::LazyInstance<ContentRendererClient> 173 base::LazyInstance<ContentRendererClient>
175 g_empty_content_renderer_client = LAZY_INSTANCE_INITIALIZER; 174 g_empty_content_renderer_client = LAZY_INSTANCE_INITIALIZER;
176 base::LazyInstance<ContentUtilityClient> 175 base::LazyInstance<ContentUtilityClient>
177 g_empty_content_utility_client = LAZY_INSTANCE_INITIALIZER; 176 g_empty_content_utility_client = LAZY_INSTANCE_INITIALIZER;
178 #endif // !OS_IOS 177 #endif // !OS_IOS && !CHROME_MULTIPLE_DLL_BROWSER
179 178
180 #if defined(OS_WIN) 179 #if defined(OS_WIN)
181 180
182 static CAppModule _Module; 181 static CAppModule _Module;
183 182
184 #endif // defined(OS_WIN) 183 #endif // defined(OS_WIN)
185 184
186 #if defined(OS_POSIX) && !defined(OS_IOS) 185 #if defined(OS_POSIX) && !defined(OS_IOS)
187 186
188 // Setup signal-handling state: resanitize most signals, ignore SIGPIPE. 187 // Setup signal-handling state: resanitize most signals, ignore SIGPIPE.
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 static void Set(const std::string& process_type, 287 static void Set(const std::string& process_type,
289 ContentMainDelegate* delegate) { 288 ContentMainDelegate* delegate) {
290 ContentClient* content_client = GetContentClient(); 289 ContentClient* content_client = GetContentClient();
291 if (process_type.empty()) { 290 if (process_type.empty()) {
292 if (delegate) 291 if (delegate)
293 content_client->browser_ = delegate->CreateContentBrowserClient(); 292 content_client->browser_ = delegate->CreateContentBrowserClient();
294 if (!content_client->browser_) 293 if (!content_client->browser_)
295 content_client->browser_ = &g_empty_content_browser_client.Get(); 294 content_client->browser_ = &g_empty_content_browser_client.Get();
296 } 295 }
297 296
298 #if !defined(OS_IOS) && \ 297 #if !defined(OS_IOS) && !defined(CHROME_MULTIPLE_DLL_BROWSER)
299 (!defined(CHROME_MULTIPLE_DLL) || defined(CHROME_MULTIPLE_DLL_CHILD))
300 if (process_type == switches::kPluginProcess || 298 if (process_type == switches::kPluginProcess ||
301 process_type == switches::kPpapiPluginProcess) { 299 process_type == switches::kPpapiPluginProcess) {
302 if (delegate) 300 if (delegate)
303 content_client->plugin_ = delegate->CreateContentPluginClient(); 301 content_client->plugin_ = delegate->CreateContentPluginClient();
304 if (!content_client->plugin_) 302 if (!content_client->plugin_)
305 content_client->plugin_ = &g_empty_content_plugin_client.Get(); 303 content_client->plugin_ = &g_empty_content_plugin_client.Get();
306 // Single process not supported in split dll mode. 304 // Single process not supported in split dll mode.
307 } else if (process_type == switches::kRendererProcess || 305 } else if (process_type == switches::kRendererProcess ||
308 CommandLine::ForCurrentProcess()->HasSwitch( 306 CommandLine::ForCurrentProcess()->HasSwitch(
309 switches::kSingleProcess)) { 307 switches::kSingleProcess)) {
310 if (delegate) 308 if (delegate)
311 content_client->renderer_ = delegate->CreateContentRendererClient(); 309 content_client->renderer_ = delegate->CreateContentRendererClient();
312 if (!content_client->renderer_) 310 if (!content_client->renderer_)
313 content_client->renderer_ = &g_empty_content_renderer_client.Get(); 311 content_client->renderer_ = &g_empty_content_renderer_client.Get();
314 } 312 }
315 313
316 if (process_type == switches::kUtilityProcess || 314 if (process_type == switches::kUtilityProcess ||
317 CommandLine::ForCurrentProcess()->HasSwitch( 315 CommandLine::ForCurrentProcess()->HasSwitch(
318 switches::kSingleProcess)) { 316 switches::kSingleProcess)) {
319 if (delegate) 317 if (delegate)
320 content_client->utility_ = delegate->CreateContentUtilityClient(); 318 content_client->utility_ = delegate->CreateContentUtilityClient();
321 // TODO(scottmg): http://crbug.com/237249 Should be in _child. 319 // TODO(scottmg): http://crbug.com/237249 Should be in _child.
322 if (!content_client->utility_) 320 if (!content_client->utility_)
323 content_client->utility_ = &g_empty_content_utility_client.Get(); 321 content_client->utility_ = &g_empty_content_utility_client.Get();
324 } 322 }
325 #endif // !OS_IOS 323 #endif // !OS_IOS && !CHROME_MULTIPLE_DLL_BROWSER
326 } 324 }
327 }; 325 };
328 326
329 // We dispatch to a process-type-specific FooMain() based on a command-line 327 // We dispatch to a process-type-specific FooMain() based on a command-line
330 // flag. This struct is used to build a table of (flag, main function) pairs. 328 // flag. This struct is used to build a table of (flag, main function) pairs.
331 struct MainFunction { 329 struct MainFunction {
332 const char* name; 330 const char* name;
333 int (*function)(const MainFunctionParams&); 331 int (*function)(const MainFunctionParams&);
334 }; 332 };
335 333
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 401
404 #if !defined(OS_IOS) 402 #if !defined(OS_IOS)
405 // Run the FooMain() for a given process type. 403 // Run the FooMain() for a given process type.
406 // If |process_type| is empty, runs BrowserMain(). 404 // If |process_type| is empty, runs BrowserMain().
407 // Returns the exit code for this process. 405 // Returns the exit code for this process.
408 int RunNamedProcessTypeMain( 406 int RunNamedProcessTypeMain(
409 const std::string& process_type, 407 const std::string& process_type,
410 const MainFunctionParams& main_function_params, 408 const MainFunctionParams& main_function_params,
411 ContentMainDelegate* delegate) { 409 ContentMainDelegate* delegate) {
412 static const MainFunction kMainFunctions[] = { 410 static const MainFunction kMainFunctions[] = {
413 #if !defined(CHROME_MULTIPLE_DLL) || defined(CHROME_MULTIPLE_DLL_BROWSER) 411 #if !defined(CHROME_MULTIPLE_DLL_CHILD)
414 { "", BrowserMain }, 412 { "", BrowserMain },
415 #endif 413 #endif
416 #if !defined(CHROME_MULTIPLE_DLL) || defined(CHROME_MULTIPLE_DLL_CHILD) 414 #if !defined(CHROME_MULTIPLE_DLL_BROWSER)
417 #if defined(ENABLE_PLUGINS) 415 #if defined(ENABLE_PLUGINS)
418 { switches::kPluginProcess, PluginMain }, 416 { switches::kPluginProcess, PluginMain },
419 { switches::kWorkerProcess, WorkerMain }, 417 { switches::kWorkerProcess, WorkerMain },
420 { switches::kPpapiPluginProcess, PpapiPluginMain }, 418 { switches::kPpapiPluginProcess, PpapiPluginMain },
421 { switches::kPpapiBrokerProcess, PpapiBrokerMain }, 419 { switches::kPpapiBrokerProcess, PpapiBrokerMain },
422 #endif // ENABLE_PLUGINS 420 #endif // ENABLE_PLUGINS
423 { switches::kUtilityProcess, UtilityMain }, 421 { switches::kUtilityProcess, UtilityMain },
424 { switches::kRendererProcess, RendererMain }, 422 { switches::kRendererProcess, RendererMain },
425 { switches::kGpuProcess, GpuMain }, 423 { switches::kGpuProcess, GpuMain },
426 #endif // !CHROME_MULTIPLE_DLL || CHROME_MULTIPLE_DLL_CHILD 424 #endif // !CHROME_MULTIPLE_DLL_BROWSER
427 }; 425 };
428 426
429 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) { 427 for (size_t i = 0; i < arraysize(kMainFunctions); ++i) {
430 if (process_type == kMainFunctions[i].name) { 428 if (process_type == kMainFunctions[i].name) {
431 if (delegate) { 429 if (delegate) {
432 int exit_code = delegate->RunProcess(process_type, 430 int exit_code = delegate->RunProcess(process_type,
433 main_function_params); 431 main_function_params);
434 #if defined(OS_ANDROID) 432 #if defined(OS_ANDROID)
435 // In Android's browser process, the negative exit code doesn't mean the 433 // In Android's browser process, the negative exit code doesn't mean the
436 // default behavior should be used as the UI message loop is managed by 434 // default behavior should be used as the UI message loop is managed by
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 821
824 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); 822 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl);
825 }; 823 };
826 824
827 // static 825 // static
828 ContentMainRunner* ContentMainRunner::Create() { 826 ContentMainRunner* ContentMainRunner::Create() {
829 return new ContentMainRunnerImpl(); 827 return new ContentMainRunnerImpl();
830 } 828 }
831 829
832 } // namespace content 830 } // namespace content
OLDNEW
« no previous file with comments | « chrome_frame/chrome_frame.gyp ('k') | content/content.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698