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

Side by Side Diff: content/plugin/plugin_main.cc

Issue 17074009: Created multi-process-friendly PowerMonitor interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Wired up to all child processes, as requested by @jam 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
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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #endif 9 #endif
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/power_monitor/power_monitor.h"
15 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
16 #include "base/threading/platform_thread.h" 15 #include "base/threading/platform_thread.h"
17 #include "base/timer/hi_res_timer_manager.h"
18 #include "content/child/child_process.h" 16 #include "content/child/child_process.h"
19 #include "content/common/content_constants_internal.h" 17 #include "content/common/content_constants_internal.h"
20 #include "content/plugin/plugin_thread.h" 18 #include "content/plugin/plugin_thread.h"
21 #include "content/public/common/content_switches.h" 19 #include "content/public/common/content_switches.h"
22 #include "content/public/common/main_function_params.h" 20 #include "content/public/common/main_function_params.h"
23 21
24 #if defined(OS_WIN) 22 #if defined(OS_WIN)
25 #include "base/win/scoped_com_initializer.h" 23 #include "base/win/scoped_com_initializer.h"
26 #include "content/public/common/injection_test_win.h" 24 #include "content/public/common/injection_test_win.h"
27 #include "sandbox/win/src/sandbox.h" 25 #include "sandbox/win/src/sandbox.h"
(...skipping 24 matching lines...) Expand all
52 TrimInterposeEnvironment(); 50 TrimInterposeEnvironment();
53 #endif 51 #endif
54 InitializeChromeApplication(); 52 InitializeChromeApplication();
55 #endif 53 #endif
56 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_UI); 54 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_UI);
57 base::PlatformThread::SetName("CrPluginMain"); 55 base::PlatformThread::SetName("CrPluginMain");
58 base::debug::TraceLog::GetInstance()->SetProcessName("Plugin Process"); 56 base::debug::TraceLog::GetInstance()->SetProcessName("Plugin Process");
59 base::debug::TraceLog::GetInstance()->SetProcessSortIndex( 57 base::debug::TraceLog::GetInstance()->SetProcessSortIndex(
60 kTraceEventPluginProcessSortIndex); 58 kTraceEventPluginProcessSortIndex);
61 59
62 base::PowerMonitor power_monitor;
63 base::HighResolutionTimerManager high_resolution_timer_manager;
64
65 const CommandLine& parsed_command_line = parameters.command_line; 60 const CommandLine& parsed_command_line = parameters.command_line;
66 61
67 #if defined(OS_LINUX) 62 #if defined(OS_LINUX)
68 63
69 #if defined(ARCH_CPU_64_BITS) 64 #if defined(ARCH_CPU_64_BITS)
70 WorkaroundFlashLAHF(); 65 WorkaroundFlashLAHF();
71 #endif 66 #endif
72 67
73 #elif defined(OS_WIN) 68 #elif defined(OS_WIN)
74 base::win::ScopedCOMInitializer com_initializer; 69 base::win::ScopedCOMInitializer com_initializer;
75 #endif 70 #endif
76 71
77 if (parsed_command_line.HasSwitch(switches::kPluginStartupDialog)) { 72 if (parsed_command_line.HasSwitch(switches::kPluginStartupDialog)) {
78 ChildProcess::WaitForDebugger("Plugin"); 73 ChildProcess::WaitForDebugger("Plugin");
79 } 74 }
80 75
81 { 76 {
82 ChildProcess plugin_process; 77 ChildProcess plugin_process;
83 plugin_process.set_main_thread(new PluginThread()); 78 plugin_process.set_main_thread(new PluginThread());
84 base::MessageLoop::current()->Run(); 79 base::MessageLoop::current()->Run();
85 } 80 }
86 81
87 return 0; 82 return 0;
88 } 83 }
89 84
90 } // namespace content 85 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698