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

Side by Side Diff: content/browser/android/content_readback_handler.h

Issue 297683005: android: add Java-side support for browser compositor async readback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_READBACK_HANDLER_H_ 5 #ifndef CONTENT_BROWSER_ANDROID_CONTENT_READBACK_HANDLER_H_
6 #define CONTENT_BROWSER_ANDROID_CONTENT_READBACK_HANDLER_H_ 6 #define CONTENT_BROWSER_ANDROID_CONTENT_READBACK_HANDLER_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include "base/android/jni_weak_ref.h" 10 #include "base/android/jni_weak_ref.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 13
14 class SkBitmap; 14 class SkBitmap;
15 15
16 namespace cc {
17 class CopyOutputResult;
18 }
19
16 namespace content { 20 namespace content {
17 21
18 // Native side of the ContentReadbackHandler.java, which issues content 22 // Native side of the ContentReadbackHandler.java, which issues content
19 // readbacks from the Java side. 23 // readbacks from the Java side.
20 class ContentReadbackHandler { 24 class ContentReadbackHandler {
21 public: 25 public:
22 // Registers the JNI methods for ContentViewRender. 26 // Registers the JNI methods for ContentViewRender.
23 static bool RegisterContentReadbackHandler(JNIEnv* env); 27 static bool RegisterContentReadbackHandler(JNIEnv* env);
24 28
25 // Methods called from Java via JNI ----------------------------------------- 29 // Methods called from Java via JNI -----------------------------------------
26 ContentReadbackHandler(JNIEnv* env, jobject obj); 30 ContentReadbackHandler(JNIEnv* env, jobject obj);
27 void Destroy(JNIEnv* env, jobject obj); 31 void Destroy(JNIEnv* env, jobject obj);
28 void GetContentBitmap(JNIEnv* env, 32 void GetContentBitmap(JNIEnv* env,
29 jobject obj, 33 jobject obj,
30 jint readback_id, 34 jint readback_id,
31 jfloat scale, 35 jfloat scale,
32 jobject config, 36 jobject config,
33 jfloat x, 37 jfloat x,
34 jfloat y, 38 jfloat y,
35 jfloat width, 39 jfloat width,
36 jfloat height, 40 jfloat height,
37 jobject content_view_core); 41 jobject content_view_core);
42 void GetCompositorBitmap(JNIEnv* env,
43 jobject obj,
44 jint readback_id,
45 jlong native_window_android);
38 46
39 private: 47 private:
48 typedef base::Callback<void(bool, const SkBitmap&)> ResultCallback;
49
40 virtual ~ContentReadbackHandler(); 50 virtual ~ContentReadbackHandler();
41 51
42 void OnFinishContentReadback(int readback_id, 52 void OnFinishReadback(int readback_id,
43 bool success, 53 bool success,
44 const SkBitmap& bitmap); 54 const SkBitmap& bitmap);
55
56 static void OnFinishCopyOutputRequest(
Ted C 2014/05/21 17:56:29 maybe this should just be in an empty namespace to
powei 2014/05/23 01:15:09 Done.
57 const ResultCallback& result_callback,
58 scoped_ptr<cc::CopyOutputResult> copy_output_result);
45 59
46 base::android::ScopedJavaGlobalRef<jobject> java_obj_; 60 base::android::ScopedJavaGlobalRef<jobject> java_obj_;
47 base::WeakPtrFactory<ContentReadbackHandler> weak_factory_; 61 base::WeakPtrFactory<ContentReadbackHandler> weak_factory_;
48 62
49 DISALLOW_COPY_AND_ASSIGN(ContentReadbackHandler); 63 DISALLOW_COPY_AND_ASSIGN(ContentReadbackHandler);
50 }; 64 };
51 65
52 } // namespace content 66 } // namespace content
53 67
54 #endif // CONTENT_BROWSER_ANDROID_CONTENT_READBACK_HANDLER_H_ 68 #endif // CONTENT_BROWSER_ANDROID_CONTENT_READBACK_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698