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

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

Issue 1312153003: jni_generator: Pass object parameters as JavaParamRef. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 3 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/app/android/content_main.h" 5 #include "content/app/android/content_main.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.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/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 10 matching lines...) Expand all
21 21
22 namespace { 22 namespace {
23 LazyInstance<scoped_ptr<ContentMainRunner> > g_content_runner = 23 LazyInstance<scoped_ptr<ContentMainRunner> > g_content_runner =
24 LAZY_INSTANCE_INITIALIZER; 24 LAZY_INSTANCE_INITIALIZER;
25 25
26 LazyInstance<scoped_ptr<ContentMainDelegate> > g_content_main_delegate = 26 LazyInstance<scoped_ptr<ContentMainDelegate> > g_content_main_delegate =
27 LAZY_INSTANCE_INITIALIZER; 27 LAZY_INSTANCE_INITIALIZER;
28 28
29 } // namespace 29 } // namespace
30 30
31 static void InitApplicationContext(JNIEnv* env, jclass clazz, jobject context) { 31 static void InitApplicationContext(JNIEnv* env,
32 const JavaParamRef<jclass>& clazz,
33 const JavaParamRef<jobject>& context) {
32 base::android::ScopedJavaLocalRef<jobject> scoped_context( 34 base::android::ScopedJavaLocalRef<jobject> scoped_context(
33 env, env->NewLocalRef(context)); 35 env, env->NewLocalRef(context));
34 base::android::InitApplicationContext(env, scoped_context); 36 base::android::InitApplicationContext(env, scoped_context);
35 } 37 }
36 38
37 static jint Start(JNIEnv* env, jclass clazz) { 39 static jint Start(JNIEnv* env, const JavaParamRef<jclass>& clazz) {
38 TRACE_EVENT0("startup", "content::Start"); 40 TRACE_EVENT0("startup", "content::Start");
39 41
40 // On Android we can have multiple requests to start the browser in process 42 // On Android we can have multiple requests to start the browser in process
41 // simultaneously. If we get an asynchonous request followed by a synchronous 43 // simultaneously. If we get an asynchonous request followed by a synchronous
42 // request then we have to call this a second time to finish starting the 44 // request then we have to call this a second time to finish starting the
43 // browser synchronously. 45 // browser synchronously.
44 if (!g_content_runner.Get().get()) { 46 if (!g_content_runner.Get().get()) {
45 ContentMainParams params(g_content_main_delegate.Get().get()); 47 ContentMainParams params(g_content_main_delegate.Get().get());
46 g_content_runner.Get().reset(ContentMainRunner::Create()); 48 g_content_runner.Get().reset(ContentMainRunner::Create());
47 g_content_runner.Get()->Initialize(params); 49 g_content_runner.Get()->Initialize(params);
48 } 50 }
49 return g_content_runner.Get()->Run(); 51 return g_content_runner.Get()->Run();
50 } 52 }
51 53
52 void SetContentMainDelegate(ContentMainDelegate* delegate) { 54 void SetContentMainDelegate(ContentMainDelegate* delegate) {
53 DCHECK(!g_content_main_delegate.Get().get()); 55 DCHECK(!g_content_main_delegate.Get().get());
54 g_content_main_delegate.Get().reset(delegate); 56 g_content_main_delegate.Get().reset(delegate);
55 } 57 }
56 58
57 bool RegisterContentMain(JNIEnv* env) { 59 bool RegisterContentMain(JNIEnv* env) {
58 return RegisterNativesImpl(env); 60 return RegisterNativesImpl(env);
59 } 61 }
60 62
61 } // namespace content 63 } // namespace content
OLDNEW
« no previous file with comments | « content/app/android/child_process_service.cc ('k') | content/browser/android/browser_startup_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698