OLD | NEW |
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 #ifndef CONTENT_BROWSER_ANDROID_CONTENT_VIEW_RENDER_VIEW_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_CONTENT_VIEW_RENDER_VIEW_H_ |
6 #define CONTENT_BROWSER_ANDROID_CONTENT_VIEW_RENDER_VIEW_H_ | 6 #define CONTENT_BROWSER_ANDROID_CONTENT_VIEW_RENDER_VIEW_H_ |
7 | 7 |
8 #include "base/android/jni_weak_ref.h" | 8 #include "base/android/jni_weak_ref.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "content/public/browser/android/compositor_client.h" | 12 #include "content/public/browser/android/compositor_client.h" |
13 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
14 | 14 |
| 15 namespace cc { |
| 16 class Layer; |
| 17 } |
| 18 |
15 namespace content { | 19 namespace content { |
16 class Compositor; | 20 class Compositor; |
| 21 class LayerTreeBuildHelper; |
17 | 22 |
18 class ContentViewRenderView : public CompositorClient { | 23 class ContentViewRenderView : public CompositorClient { |
19 public: | 24 public: |
20 // Registers the JNI methods for ContentViewRender. | 25 // Registers the JNI methods for ContentViewRender. |
21 static bool RegisterContentViewRenderView(JNIEnv* env); | 26 static bool RegisterContentViewRenderView(JNIEnv* env); |
22 | 27 |
23 ContentViewRenderView(JNIEnv* env, | 28 ContentViewRenderView(JNIEnv* env, |
24 jobject obj, | 29 jobject obj, |
25 gfx::NativeWindow root_window); | 30 gfx::NativeWindow root_window); |
26 | 31 |
27 // Methods called from Java via JNI ----------------------------------------- | 32 // Methods called from Java via JNI ----------------------------------------- |
28 void Destroy(JNIEnv* env, jobject obj); | 33 void Destroy(JNIEnv* env, jobject obj); |
29 void SetCurrentContentViewCore(JNIEnv* env, jobject obj, | 34 void SetCurrentContentViewCore(JNIEnv* env, jobject obj, |
30 jlong native_content_view_core); | 35 jlong native_content_view_core); |
| 36 void SetLayerTreeBuildHelper( |
| 37 JNIEnv* env, jobject obj, jlong native_build_helper); |
31 void SurfaceCreated(JNIEnv* env, jobject obj); | 38 void SurfaceCreated(JNIEnv* env, jobject obj); |
32 void SurfaceDestroyed(JNIEnv* env, jobject obj); | 39 void SurfaceDestroyed(JNIEnv* env, jobject obj); |
33 void SurfaceChanged(JNIEnv* env, jobject obj, | 40 void SurfaceChanged(JNIEnv* env, jobject obj, |
34 jint format, jint width, jint height, jobject surface); | 41 jint format, jint width, jint height, jobject surface); |
35 jboolean Composite(JNIEnv* env, jobject obj); | 42 jboolean Composite(JNIEnv* env, jobject obj); |
36 jboolean CompositeToBitmap(JNIEnv* env, jobject obj, jobject java_bitmap); | 43 jboolean CompositeToBitmap(JNIEnv* env, jobject obj, jobject java_bitmap); |
37 void SetOverlayVideoMode(JNIEnv* env, jobject obj, bool enabled); | 44 void SetOverlayVideoMode(JNIEnv* env, jobject obj, bool enabled); |
38 | 45 |
39 // CompositorClient --------------------------------------------------------- | 46 // CompositorClient --------------------------------------------------------- |
40 virtual void ScheduleComposite() OVERRIDE; | 47 virtual void ScheduleComposite() OVERRIDE; |
41 virtual void OnSwapBuffersPosted() OVERRIDE; | 48 virtual void OnSwapBuffersPosted() OVERRIDE; |
42 virtual void OnSwapBuffersCompleted() OVERRIDE; | 49 virtual void OnSwapBuffersCompleted() OVERRIDE; |
43 | 50 |
44 private: | 51 private: |
45 virtual ~ContentViewRenderView(); | 52 virtual ~ContentViewRenderView(); |
46 | 53 |
47 void InitCompositor(); | 54 void InitCompositor(); |
48 | 55 |
49 bool buffers_swapped_during_composite_; | 56 bool buffers_swapped_during_composite_; |
50 | 57 |
51 base::android::ScopedJavaGlobalRef<jobject> java_obj_; | 58 base::android::ScopedJavaGlobalRef<jobject> java_obj_; |
| 59 scoped_refptr<cc::Layer> root_layer_; |
| 60 scoped_ptr<LayerTreeBuildHelper> layer_tree_build_helper_; |
52 | 61 |
53 scoped_ptr<content::Compositor> compositor_; | 62 scoped_ptr<content::Compositor> compositor_; |
54 | 63 |
55 gfx::NativeWindow root_window_; | 64 gfx::NativeWindow root_window_; |
56 int current_surface_format_; | 65 int current_surface_format_; |
57 | 66 |
58 DISALLOW_COPY_AND_ASSIGN(ContentViewRenderView); | 67 DISALLOW_COPY_AND_ASSIGN(ContentViewRenderView); |
59 }; | 68 }; |
60 | 69 |
61 | 70 |
62 | 71 |
63 } | 72 } |
64 | 73 |
65 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_RENDER_VIEW_H_ | 74 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_RENDER_VIEW_H_ |
OLD | NEW |