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

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

Issue 11273049: Revert 164120 - content/browser: Move more files into the content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month 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_url_handler_impl.h » ('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/browser/browser_main_runner.h" 5 #include "content/public/browser/browser_main_runner.h"
6 6
7 #include "base/allocator/allocator_shim.h" 7 #include "base/allocator/allocator_shim.h"
8 #include "base/base_switches.h" 8 #include "base/base_switches.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 11 matching lines...) Expand all
22 #include "ui/base/win/scoped_ole_initializer.h" 22 #include "ui/base/win/scoped_ole_initializer.h"
23 #include "ui/base/ime/win/tsf_bridge.h" 23 #include "ui/base/ime/win/tsf_bridge.h"
24 #endif 24 #endif
25 25
26 #if defined(OS_ANDROID) 26 #if defined(OS_ANDROID)
27 #include "content/browser/android/surface_texture_peer_browser_impl.h" 27 #include "content/browser/android/surface_texture_peer_browser_impl.h"
28 #endif 28 #endif
29 29
30 bool g_exited_main_message_loop = false; 30 bool g_exited_main_message_loop = false;
31 31
32 namespace content { 32 using content::ChildProcess;
33 33
34 namespace { 34 namespace {
35 35
36 class BrowserMainRunnerImpl : public BrowserMainRunner { 36 class BrowserMainRunnerImpl : public content::BrowserMainRunner {
37 public: 37 public:
38 BrowserMainRunnerImpl() 38 BrowserMainRunnerImpl()
39 : is_initialized_(false), 39 : is_initialized_(false),
40 is_shutdown_(false), 40 is_shutdown_(false),
41 created_threads_(false) { 41 created_threads_(false) {
42 } 42 }
43 43
44 ~BrowserMainRunnerImpl() { 44 ~BrowserMainRunnerImpl() {
45 if (is_initialized_ && !is_shutdown_) 45 if (is_initialized_ && !is_shutdown_)
46 Shutdown(); 46 Shutdown();
47 } 47 }
48 48
49 virtual int Initialize(const MainFunctionParams& parameters) 49 virtual int Initialize(const content::MainFunctionParams& parameters)
50 OVERRIDE { 50 OVERRIDE {
51 is_initialized_ = true; 51 is_initialized_ = true;
52 52
53 #if !defined(OS_IOS) 53 #if !defined(OS_IOS)
54 // ChildProcess:: is a misnomer unless you consider context. Use 54 // ChildProcess:: is a misnomer unless you consider context. Use
55 // of --wait-for-debugger only makes sense when Chrome itself is a 55 // of --wait-for-debugger only makes sense when Chrome itself is a
56 // child process (e.g. when launched by PyAuto). 56 // child process (e.g. when launched by PyAuto).
57 if (parameters.command_line.HasSwitch(switches::kWaitForDebugger)) 57 if (parameters.command_line.HasSwitch(switches::kWaitForDebugger))
58 ChildProcess::WaitForDebugger("Browser"); 58 ChildProcess::WaitForDebugger("Browser");
59 #endif // !defined(OS_IOS) 59 #endif // !defined(OS_IOS)
60 60
61 #if defined(OS_WIN) 61 #if defined(OS_WIN)
62 if (parameters.command_line.HasSwitch( 62 if (parameters.command_line.HasSwitch(
63 switches::kEnableTextServicesFramework)) { 63 switches::kEnableTextServicesFramework)) {
64 base::win::SetForceToUseTsf(); 64 base::win::SetForceToUseTsf();
65 } 65 }
66 #endif // OS_WIN 66 #endif // OS_WIN
67 67
68 base::StatisticsRecorder::Initialize(); 68 base::StatisticsRecorder::Initialize();
69 69
70 notification_service_.reset(new NotificationServiceImpl); 70 notification_service_.reset(new NotificationServiceImpl);
71 71
72 main_loop_.reset(new BrowserMainLoop(parameters)); 72 main_loop_.reset(new content::BrowserMainLoop(parameters));
73 73
74 main_loop_->Init(); 74 main_loop_->Init();
75 75
76 main_loop_->EarlyInitialization(); 76 main_loop_->EarlyInitialization();
77 77
78 // Must happen before we try to use a message loop or display any UI. 78 // Must happen before we try to use a message loop or display any UI.
79 main_loop_->InitializeToolkit(); 79 main_loop_->InitializeToolkit();
80 80
81 main_loop_->MainMessageLoopStart(); 81 main_loop_->MainMessageLoopStart();
82 82
83 // WARNING: If we get a WM_ENDSESSION, objects created on the stack here 83 // WARNING: If we get a WM_ENDSESSION, objects created on the stack here
84 // are NOT deleted. If you need something to run during WM_ENDSESSION add it 84 // are NOT deleted. If you need something to run during WM_ENDSESSION add it
85 // to browser_shutdown::Shutdown or BrowserProcess::EndSession. 85 // to browser_shutdown::Shutdown or BrowserProcess::EndSession.
86 86
87 #if defined(OS_WIN) 87 #if defined(OS_WIN)
88 #if !defined(NO_TCMALLOC) 88 #if !defined(NO_TCMALLOC)
89 // When linking shared libraries, NO_TCMALLOC is defined, and dynamic 89 // When linking shared libraries, NO_TCMALLOC is defined, and dynamic
90 // allocator selection is not supported. 90 // allocator selection is not supported.
91 91
92 // Make this call before going multithreaded, or spawning any subprocesses. 92 // Make this call before going multithreaded, or spawning any subprocesses.
93 base::allocator::SetupSubprocessAllocator(); 93 base::allocator::SetupSubprocessAllocator();
94 #endif 94 #endif
95 ole_initializer_.reset(new ui::ScopedOleInitializer); 95 ole_initializer_.reset(new ui::ScopedOleInitializer);
96 if (base::win::IsTsfAwareRequired()) 96 if (base::win::IsTsfAwareRequired())
97 ui::TsfBridge::Initialize(); 97 ui::TsfBridge::Initialize();
98 #endif // OS_WIN 98 #endif // OS_WIN
99 99
100 #if defined(OS_ANDROID) 100 #if defined(OS_ANDROID)
101 SurfaceTexturePeer::InitInstance( 101 content::SurfaceTexturePeer::InitInstance(
102 new SurfaceTexturePeerBrowserImpl( 102 new content::SurfaceTexturePeerBrowserImpl(
103 parameters.command_line.HasSwitch( 103 parameters.command_line.HasSwitch(
104 switches::kMediaPlayerInRenderProcess))); 104 switches::kMediaPlayerInRenderProcess)));
105 #endif 105 #endif
106 106
107 main_loop_->CreateThreads(); 107 main_loop_->CreateThreads();
108 int result_code = main_loop_->GetResultCode(); 108 int result_code = main_loop_->GetResultCode();
109 if (result_code > 0) 109 if (result_code > 0)
110 return result_code; 110 return result_code;
111 created_threads_ = true; 111 created_threads_ = true;
112 112
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 // True if the runner has been initialized. 146 // True if the runner has been initialized.
147 bool is_initialized_; 147 bool is_initialized_;
148 148
149 // True if the runner has been shut down. 149 // True if the runner has been shut down.
150 bool is_shutdown_; 150 bool is_shutdown_;
151 151
152 // True if the non-UI threads were created. 152 // True if the non-UI threads were created.
153 bool created_threads_; 153 bool created_threads_;
154 154
155 scoped_ptr<NotificationServiceImpl> notification_service_; 155 scoped_ptr<NotificationServiceImpl> notification_service_;
156 scoped_ptr<BrowserMainLoop> main_loop_; 156 scoped_ptr<content::BrowserMainLoop> main_loop_;
157 #if defined(OS_WIN) 157 #if defined(OS_WIN)
158 scoped_ptr<ui::ScopedOleInitializer> ole_initializer_; 158 scoped_ptr<ui::ScopedOleInitializer> ole_initializer_;
159 #endif 159 #endif
160 160
161 DISALLOW_COPY_AND_ASSIGN(BrowserMainRunnerImpl); 161 DISALLOW_COPY_AND_ASSIGN(BrowserMainRunnerImpl);
162 }; 162 };
163 163
164 } // namespace 164 } // namespace
165 165
166 namespace content {
167
166 // static 168 // static
167 BrowserMainRunner* BrowserMainRunner::Create() { 169 BrowserMainRunner* BrowserMainRunner::Create() {
168 return new BrowserMainRunnerImpl(); 170 return new BrowserMainRunnerImpl();
169 } 171 }
170 172
171 } // namespace content 173 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_main_loop.h ('k') | content/browser/browser_url_handler_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698