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

Side by Side Diff: content/app/android/content_main.cc

Issue 1874903002: Convert //content from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix indent 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
« no previous file with comments | « components/ui/zoom/zoom_event_manager.h ('k') | content/app/content_main.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/app/android/content_main.h" 5 #include "content/app/android/content_main.h"
6 6
7 #include <memory>
8
7 #include "base/at_exit.h" 9 #include "base/at_exit.h"
8 #include "base/base_switches.h" 10 #include "base/base_switches.h"
9 #include "base/command_line.h" 11 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/trace_event/trace_event.h" 13 #include "base/trace_event/trace_event.h"
13 #include "content/public/app/content_main.h" 14 #include "content/public/app/content_main.h"
14 #include "content/public/app/content_main_delegate.h" 15 #include "content/public/app/content_main_delegate.h"
15 #include "content/public/app/content_main_runner.h" 16 #include "content/public/app/content_main_runner.h"
16 #include "content/public/common/content_switches.h" 17 #include "content/public/common/content_switches.h"
17 #include "jni/ContentMain_jni.h" 18 #include "jni/ContentMain_jni.h"
18 19
19 using base::LazyInstance; 20 using base::LazyInstance;
20 21
21 namespace content { 22 namespace content {
22 23
23 namespace { 24 namespace {
24 LazyInstance<scoped_ptr<ContentMainRunner> > g_content_runner = 25 LazyInstance<std::unique_ptr<ContentMainRunner>> g_content_runner =
25 LAZY_INSTANCE_INITIALIZER; 26 LAZY_INSTANCE_INITIALIZER;
26 27
27 LazyInstance<scoped_ptr<ContentMainDelegate> > g_content_main_delegate = 28 LazyInstance<std::unique_ptr<ContentMainDelegate>> g_content_main_delegate =
28 LAZY_INSTANCE_INITIALIZER; 29 LAZY_INSTANCE_INITIALIZER;
29 30
30 } // namespace 31 } // namespace
31 32
32 static jint Start(JNIEnv* env, const JavaParamRef<jclass>& clazz) { 33 static jint Start(JNIEnv* env, const JavaParamRef<jclass>& clazz) {
33 TRACE_EVENT0("startup", "content::Start"); 34 TRACE_EVENT0("startup", "content::Start");
34 35
35 // On Android we can have multiple requests to start the browser in process 36 // On Android we can have multiple requests to start the browser in process
36 // simultaneously. If we get an asynchonous request followed by a synchronous 37 // simultaneously. If we get an asynchonous request followed by a synchronous
37 // request then we have to call this a second time to finish starting the 38 // request then we have to call this a second time to finish starting the
38 // browser synchronously. 39 // browser synchronously.
39 if (!g_content_runner.Get().get()) { 40 if (!g_content_runner.Get().get()) {
40 ContentMainParams params(g_content_main_delegate.Get().get()); 41 ContentMainParams params(g_content_main_delegate.Get().get());
41 g_content_runner.Get().reset(ContentMainRunner::Create()); 42 g_content_runner.Get().reset(ContentMainRunner::Create());
42 g_content_runner.Get()->Initialize(params); 43 g_content_runner.Get()->Initialize(params);
43 } 44 }
44 return g_content_runner.Get()->Run(); 45 return g_content_runner.Get()->Run();
45 } 46 }
46 47
47 void SetContentMainDelegate(ContentMainDelegate* delegate) { 48 void SetContentMainDelegate(ContentMainDelegate* delegate) {
48 DCHECK(!g_content_main_delegate.Get().get()); 49 DCHECK(!g_content_main_delegate.Get().get());
49 g_content_main_delegate.Get().reset(delegate); 50 g_content_main_delegate.Get().reset(delegate);
50 } 51 }
51 52
52 bool RegisterContentMain(JNIEnv* env) { 53 bool RegisterContentMain(JNIEnv* env) {
53 return RegisterNativesImpl(env); 54 return RegisterNativesImpl(env);
54 } 55 }
55 56
56 } // namespace content 57 } // namespace content
OLDNEW
« no previous file with comments | « components/ui/zoom/zoom_event_manager.h ('k') | content/app/content_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698