| 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_helper.h" | 8 #include "base/android/jni_helper.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 "content/public/browser/android/compositor_provider.h" |
| 14 #include "content/public/browser/android/compositor_provider_client.h" |
| 13 | 15 |
| 14 namespace content { | 16 namespace content { |
| 15 class Compositor; | 17 class Compositor; |
| 16 | 18 |
| 17 class ContentViewRenderView : public CompositorClient { | 19 class ContentViewRenderView : public CompositorClient, |
| 20 public CompositorProvider { |
| 18 public: | 21 public: |
| 19 // Registers the JNI methods for ContentViewRender. | 22 // Registers the JNI methods for ContentViewRender. |
| 20 static bool RegisterContentViewRenderView(JNIEnv* env); | 23 static bool RegisterContentViewRenderView(JNIEnv* env); |
| 21 | 24 |
| 22 ContentViewRenderView(JNIEnv* env, jobject obj); | 25 ContentViewRenderView(JNIEnv* env, jobject obj); |
| 23 | 26 |
| 24 // Methods called from Java via JNI ----------------------------------------- | 27 // Methods called from Java via JNI ----------------------------------------- |
| 25 void Destroy(JNIEnv* env, jobject obj); | 28 void Destroy(JNIEnv* env, jobject obj); |
| 26 void SetCurrentContentView(JNIEnv* env, jobject obj, int native_content_view); | 29 void SetCurrentContentView(JNIEnv* env, jobject obj, int native_content_view); |
| 27 void SurfaceCreated(JNIEnv* env, jobject obj, jobject jsurface); | 30 void SurfaceCreated(JNIEnv* env, jobject obj, jobject jsurface); |
| 28 void SurfaceDestroyed(JNIEnv* env, jobject obj); | 31 void SurfaceDestroyed(JNIEnv* env, jobject obj); |
| 29 void SurfaceSetSize(JNIEnv* env, jobject obj, jint width, jint height); | 32 void SurfaceSetSize(JNIEnv* env, jobject obj, jint width, jint height); |
| 30 jboolean Composite(JNIEnv* env, jobject obj); | 33 jboolean Composite(JNIEnv* env, jobject obj); |
| 31 jboolean CompositeToBitmap(JNIEnv* env, jobject obj, jobject java_bitmap); | 34 jboolean CompositeToBitmap(JNIEnv* env, jobject obj, jobject java_bitmap); |
| 35 jint GetNativeCompositorProviderPtr(JNIEnv* env, jobject obj); |
| 32 | 36 |
| 33 // CompositorClient --------------------------------------------------------- | 37 // CompositorClient --------------------------------------------------------- |
| 34 virtual void ScheduleComposite() OVERRIDE; | 38 virtual void ScheduleComposite() OVERRIDE; |
| 35 virtual void OnSwapBuffersPosted() OVERRIDE; | 39 virtual void OnSwapBuffersPosted() OVERRIDE; |
| 36 virtual void OnSwapBuffersCompleted() OVERRIDE; | 40 virtual void OnSwapBuffersCompleted() OVERRIDE; |
| 37 | 41 |
| 42 // CompositorProvider ------------------------------------------------------- |
| 43 virtual Compositor* GetCompositor() OVERRIDE; |
| 44 // Since the compositor never switches out, do not need to implement this. |
| 45 virtual void AddCompositorProviderClient(CompositorProviderClient* client) |
| 46 OVERRIDE {} |
| 47 |
| 38 private: | 48 private: |
| 39 virtual ~ContentViewRenderView(); | 49 virtual ~ContentViewRenderView(); |
| 40 | 50 |
| 41 void InitCompositor(); | 51 void InitCompositor(); |
| 42 | 52 |
| 43 bool buffers_swapped_during_composite_; | 53 bool buffers_swapped_during_composite_; |
| 44 | 54 |
| 45 base::android::ScopedJavaGlobalRef<jobject> java_obj_; | 55 base::android::ScopedJavaGlobalRef<jobject> java_obj_; |
| 46 | 56 |
| 47 scoped_ptr<content::Compositor> compositor_; | 57 scoped_ptr<content::Compositor> compositor_; |
| 48 | 58 |
| 49 DISALLOW_COPY_AND_ASSIGN(ContentViewRenderView); | 59 DISALLOW_COPY_AND_ASSIGN(ContentViewRenderView); |
| 50 }; | 60 }; |
| 51 | 61 |
| 52 | 62 |
| 53 | 63 |
| 54 } | 64 } |
| 55 | 65 |
| 56 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_RENDER_VIEW_H_ | 66 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_RENDER_VIEW_H_ |
| OLD | NEW |