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

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

Issue 1874893002: Convert //content/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/leak_annotations.h" 9 #include "base/debug/leak_annotations.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // only for processes which do not instantiate a BrowserProcess. 165 // only for processes which do not instantiate a BrowserProcess.
166 // If leaks are found, the process will exit here. 166 // If leaks are found, the process will exit here.
167 __lsan_do_leak_check(); 167 __lsan_do_leak_check();
168 #endif 168 #endif
169 // If startup tracing has not been finished yet, replace it's dumper 169 // If startup tracing has not been finished yet, replace it's dumper
170 // with special version, which would save trace file on exit (i.e. 170 // with special version, which would save trace file on exit (i.e.
171 // startup tracing becomes a version of shutdown tracing). 171 // startup tracing becomes a version of shutdown tracing).
172 // There are two cases: 172 // There are two cases:
173 // 1. Startup duration is not reached. 173 // 1. Startup duration is not reached.
174 // 2. Or startup duration is not specified for --trace-config-file flag. 174 // 2. Or startup duration is not specified for --trace-config-file flag.
175 scoped_ptr<BrowserShutdownProfileDumper> startup_profiler; 175 std::unique_ptr<BrowserShutdownProfileDumper> startup_profiler;
176 if (main_loop_->is_tracing_startup_for_duration()) { 176 if (main_loop_->is_tracing_startup_for_duration()) {
177 main_loop_->StopStartupTracingTimer(); 177 main_loop_->StopStartupTracingTimer();
178 if (main_loop_->startup_trace_file() != 178 if (main_loop_->startup_trace_file() !=
179 base::FilePath().AppendASCII("none")) { 179 base::FilePath().AppendASCII("none")) {
180 startup_profiler.reset( 180 startup_profiler.reset(
181 new BrowserShutdownProfileDumper(main_loop_->startup_trace_file())); 181 new BrowserShutdownProfileDumper(main_loop_->startup_trace_file()));
182 } 182 }
183 } else if (tracing::TraceConfigFile::GetInstance()->IsEnabled() && 183 } else if (tracing::TraceConfigFile::GetInstance()->IsEnabled() &&
184 TracingController::GetInstance()->IsTracing()) { 184 TracingController::GetInstance()->IsTracing()) {
185 base::FilePath result_file; 185 base::FilePath result_file;
186 #if defined(OS_ANDROID) 186 #if defined(OS_ANDROID)
187 TracingControllerAndroid::GenerateTracingFilePath(&result_file); 187 TracingControllerAndroid::GenerateTracingFilePath(&result_file);
188 #else 188 #else
189 result_file = tracing::TraceConfigFile::GetInstance()->GetResultFile(); 189 result_file = tracing::TraceConfigFile::GetInstance()->GetResultFile();
190 #endif 190 #endif
191 startup_profiler.reset(new BrowserShutdownProfileDumper(result_file)); 191 startup_profiler.reset(new BrowserShutdownProfileDumper(result_file));
192 } 192 }
193 193
194 // The shutdown tracing got enabled in AttemptUserExit earlier, but someone 194 // The shutdown tracing got enabled in AttemptUserExit earlier, but someone
195 // needs to write the result to disc. For that a dumper needs to get created 195 // needs to write the result to disc. For that a dumper needs to get created
196 // which will dump the traces to disc when it gets destroyed. 196 // which will dump the traces to disc when it gets destroyed.
197 const base::CommandLine& command_line = 197 const base::CommandLine& command_line =
198 *base::CommandLine::ForCurrentProcess(); 198 *base::CommandLine::ForCurrentProcess();
199 scoped_ptr<BrowserShutdownProfileDumper> shutdown_profiler; 199 std::unique_ptr<BrowserShutdownProfileDumper> shutdown_profiler;
200 if (command_line.HasSwitch(switches::kTraceShutdown)) { 200 if (command_line.HasSwitch(switches::kTraceShutdown)) {
201 shutdown_profiler.reset(new BrowserShutdownProfileDumper( 201 shutdown_profiler.reset(new BrowserShutdownProfileDumper(
202 BrowserShutdownProfileDumper::GetShutdownProfileFileName())); 202 BrowserShutdownProfileDumper::GetShutdownProfileFileName()));
203 } 203 }
204 204
205 { 205 {
206 // The trace event has to stay between profiler creation and destruction. 206 // The trace event has to stay between profiler creation and destruction.
207 TRACE_EVENT0("shutdown", "BrowserMainRunner"); 207 TRACE_EVENT0("shutdown", "BrowserMainRunner");
208 g_exited_main_message_loop = true; 208 g_exited_main_message_loop = true;
209 209
(...skipping 18 matching lines...) Expand all
228 } 228 }
229 } 229 }
230 230
231 protected: 231 protected:
232 // True if we have started to initialize the runner. 232 // True if we have started to initialize the runner.
233 bool initialization_started_; 233 bool initialization_started_;
234 234
235 // True if the runner has been shut down. 235 // True if the runner has been shut down.
236 bool is_shutdown_; 236 bool is_shutdown_;
237 237
238 scoped_ptr<NotificationServiceImpl> notification_service_; 238 std::unique_ptr<NotificationServiceImpl> notification_service_;
239 scoped_ptr<BrowserMainLoop> main_loop_; 239 std::unique_ptr<BrowserMainLoop> main_loop_;
240 #if defined(OS_WIN) 240 #if defined(OS_WIN)
241 scoped_ptr<ui::ScopedOleInitializer> ole_initializer_; 241 std::unique_ptr<ui::ScopedOleInitializer> ole_initializer_;
242 #endif 242 #endif
243 243
244 private: 244 private:
245 DISALLOW_COPY_AND_ASSIGN(BrowserMainRunnerImpl); 245 DISALLOW_COPY_AND_ASSIGN(BrowserMainRunnerImpl);
246 }; 246 };
247 247
248 // static 248 // static
249 BrowserMainRunner* BrowserMainRunner::Create() { 249 BrowserMainRunner* BrowserMainRunner::Create() {
250 return new BrowserMainRunnerImpl(); 250 return new BrowserMainRunnerImpl();
251 } 251 }
252 252
253 // static 253 // static
254 bool BrowserMainRunner::ExitedMainMessageLoop() { 254 bool BrowserMainRunner::ExitedMainMessageLoop() {
255 return g_exited_main_message_loop; 255 return g_exited_main_message_loop;
256 } 256 }
257 257
258 } // namespace content 258 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/browser/browser_plugin/browser_plugin_guest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698