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

Side by Side Diff: content/browser/android/content_view_render_view.cc

Issue 201583004: Add layerTreeBuildHelper to control layer tree in ContentViewRenderView (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed indenting Created 6 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 | Annotate | Revision Log
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/browser/android/content_view_render_view.h" 5 #include "content/browser/android/content_view_render_view.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"
(...skipping 20 matching lines...) Expand all
31 return RegisterNativesImpl(env); 31 return RegisterNativesImpl(env);
32 } 32 }
33 33
34 ContentViewRenderView::ContentViewRenderView(JNIEnv* env, 34 ContentViewRenderView::ContentViewRenderView(JNIEnv* env,
35 jobject obj, 35 jobject obj,
36 gfx::NativeWindow root_window) 36 gfx::NativeWindow root_window)
37 : buffers_swapped_during_composite_(false), 37 : buffers_swapped_during_composite_(false),
38 root_window_(root_window), 38 root_window_(root_window),
39 current_surface_format_(0) { 39 current_surface_format_(0) {
40 java_obj_.Reset(env, obj); 40 java_obj_.Reset(env, obj);
41 Java_ContentViewRenderView_setNativePtr(
42 env, obj, reinterpret_cast<intptr_t>(this));
41 } 43 }
42 44
43 ContentViewRenderView::~ContentViewRenderView() { 45 ContentViewRenderView::~ContentViewRenderView() {
46 JNIEnv* env = base::android::AttachCurrentThread();
47 if (java_obj_.is_null())
48 return;
49
50 Java_ContentViewRenderView_clearNativePtr(env, java_obj_.obj());
44 } 51 }
45 52
46 // static 53 // static
47 static jlong Init(JNIEnv* env, jobject obj, jlong native_root_window) { 54 static void Init(JNIEnv* env, jobject obj, jlong native_root_window) {
48 gfx::NativeWindow root_window = 55 gfx::NativeWindow root_window =
49 reinterpret_cast<gfx::NativeWindow>(native_root_window); 56 reinterpret_cast<gfx::NativeWindow>(native_root_window);
50 ContentViewRenderView* content_view_render_view = 57 new ContentViewRenderView(env, obj, root_window);
Yaron 2014/03/19 19:00:12 Hmm, this mirrors TabAndroid but it's a dangerous
51 new ContentViewRenderView(env, obj, root_window);
52 return reinterpret_cast<intptr_t>(content_view_render_view);
53 } 58 }
54 59
55 void ContentViewRenderView::Destroy(JNIEnv* env, jobject obj) { 60 void ContentViewRenderView::Destroy(JNIEnv* env, jobject obj) {
56 delete this; 61 delete this;
57 } 62 }
58 63
59 void ContentViewRenderView::SetCurrentContentView( 64 void ContentViewRenderView::SetCurrentContentView(
60 JNIEnv* env, jobject obj, jlong native_content_view) { 65 JNIEnv* env, jobject obj, jlong native_content_view) {
61 InitCompositor(); 66 InitCompositor();
62 ContentViewCoreImpl* content_view = 67 ContentViewCoreImpl* content_view =
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 JNIEnv* env = base::android::AttachCurrentThread(); 128 JNIEnv* env = base::android::AttachCurrentThread();
124 Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_.obj()); 129 Java_ContentViewRenderView_onSwapBuffersCompleted(env, java_obj_.obj());
125 } 130 }
126 131
127 void ContentViewRenderView::InitCompositor() { 132 void ContentViewRenderView::InitCompositor() {
128 if (!compositor_) 133 if (!compositor_)
129 compositor_.reset(Compositor::Create(this, root_window_)); 134 compositor_.reset(Compositor::Create(this, root_window_));
130 } 135 }
131 136
132 } // namespace content 137 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698