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

Side by Side Diff: content/shell/android/shell_manager.cc

Issue 2733283002: Require explicit selection of traits for LazyInstance (Closed)
Patch Set: Created 3 years, 9 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/shell/android/shell_manager.h" 5 #include "content/shell/android/shell_manager.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/android/scoped_java_ref.h" 9 #include "base/android/scoped_java_ref.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
13 #include "content/shell/browser/shell.h" 13 #include "content/shell/browser/shell.h"
14 #include "content/shell/browser/shell_browser_context.h" 14 #include "content/shell/browser/shell_browser_context.h"
15 #include "content/shell/browser/shell_content_browser_client.h" 15 #include "content/shell/browser/shell_content_browser_client.h"
16 #include "jni/ShellManager_jni.h" 16 #include "jni/ShellManager_jni.h"
17 #include "url/gurl.h" 17 #include "url/gurl.h"
18 18
19 using base::android::JavaParamRef; 19 using base::android::JavaParamRef;
20 using base::android::JavaRef; 20 using base::android::JavaRef;
21 using base::android::ScopedJavaLocalRef; 21 using base::android::ScopedJavaLocalRef;
22 22
23 namespace { 23 namespace {
24 24
25 struct GlobalState { 25 struct GlobalState {
26 GlobalState() {} 26 GlobalState() {}
27 base::android::ScopedJavaGlobalRef<jobject> j_shell_manager; 27 base::android::ScopedJavaGlobalRef<jobject> j_shell_manager;
28 }; 28 };
29 29
30 base::LazyInstance<GlobalState> g_global_state = LAZY_INSTANCE_INITIALIZER; 30 base::LazyInstance<GlobalState>::DestructorAtExit g_global_state =
31 LAZY_INSTANCE_INITIALIZER;
31 32
32 } // namespace 33 } // namespace
33 34
34 namespace content { 35 namespace content {
35 36
36 ScopedJavaLocalRef<jobject> CreateShellView(Shell* shell) { 37 ScopedJavaLocalRef<jobject> CreateShellView(Shell* shell) {
37 JNIEnv* env = base::android::AttachCurrentThread(); 38 JNIEnv* env = base::android::AttachCurrentThread();
38 return Java_ShellManager_createShell(env, 39 return Java_ShellManager_createShell(env,
39 g_global_state.Get().j_shell_manager, 40 g_global_state.Get().j_shell_manager,
40 reinterpret_cast<intptr_t>(shell)); 41 reinterpret_cast<intptr_t>(shell));
(...skipping 22 matching lines...) Expand all
63 ShellBrowserContext* browserContext = 64 ShellBrowserContext* browserContext =
64 ShellContentBrowserClient::Get()->browser_context(); 65 ShellContentBrowserClient::Get()->browser_context();
65 GURL url(base::android::ConvertJavaStringToUTF8(env, jurl)); 66 GURL url(base::android::ConvertJavaStringToUTF8(env, jurl));
66 Shell::CreateNewWindow(browserContext, 67 Shell::CreateNewWindow(browserContext,
67 url, 68 url,
68 NULL, 69 NULL,
69 gfx::Size()); 70 gfx::Size());
70 } 71 }
71 72
72 } // namespace content 73 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698