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

Unified Diff: chrome/android/testshell/tab_manager.cc

Issue 11108004: Android Browser Compositor: Add ScheduleComposite() callback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/testshell/tab_manager.cc
diff --git a/chrome/android/testshell/tab_manager.cc b/chrome/android/testshell/tab_manager.cc
index 97ccbe1bcff95621c6424df1b995945040acb826..fb4a88891324420f9bd4d94ec9eca2556e501665 100644
--- a/chrome/android/testshell/tab_manager.cc
+++ b/chrome/android/testshell/tab_manager.cc
@@ -22,9 +22,15 @@ using base::android::ScopedJavaLocalRef;
namespace {
+class CompositorClient : public content::Compositor::Client {
+ public:
+ virtual void ScheduleComposite() OVERRIDE;
+};
+
struct GlobalState {
scoped_ptr<content::Compositor> compositor;
scoped_ptr<WebKit::WebLayer> root_layer;
+ CompositorClient client;
};
base::LazyInstance<GlobalState> g_global_state = LAZY_INSTANCE_INITIALIZER;
@@ -33,20 +39,10 @@ content::Compositor* GetCompositor() {
return g_global_state.Get().compositor.get();
}
-static void SurfacePresented(
- const content::DrawDelegate::SurfacePresentedCallback& callback,
- uint32 sync_point) {
- callback.Run(sync_point);
-}
-
-void DummyCallback(uint32) { }
-
-static void SurfaceUpdated(
- uint64 texture,
- content::RenderWidgetHostView* view,
- const content::DrawDelegate::SurfacePresentedCallback& callback) {
- GetCompositor()->OnSurfaceUpdated(base::Bind(
- &SurfacePresented, callback));
+void CompositorClient::ScheduleComposite() {
+ // Composite immediately
+ if (GetCompositor())
+ GetCompositor()->Composite();
}
} // anonymous namespace
@@ -59,12 +55,10 @@ bool RegisterTabManager(JNIEnv* env) {
}
static void Init(JNIEnv* env, jclass clazz, jobject obj) {
- content::DrawDelegate::SurfaceUpdatedCallback cb = base::Bind(
- &SurfaceUpdated);
- content::DrawDelegate::GetInstance()->SetUpdateCallback(cb);
if (!GetCompositor()) {
content::Compositor::Initialize();
- g_global_state.Get().compositor.reset(content::Compositor::Create());
+ g_global_state.Get().compositor.reset(content::Compositor::Create(
+ &g_global_state.Get().client));
DCHECK(!g_global_state.Get().root_layer.get());
g_global_state.Get().root_layer.reset(WebKit::WebLayer::create());
}
@@ -95,7 +89,6 @@ static void ShowTab(JNIEnv* env, jclass clazz, jint jtab) {
return;
TabBaseAndroidImpl* tab = reinterpret_cast<TabBaseAndroidImpl*>(jtab);
g_global_state.Get().root_layer->addChild(tab->tab_layer());
- GetCompositor()->OnSurfaceUpdated(base::Bind(&DummyCallback));
}
static void HideTab(JNIEnv* env, jclass clazz, jint jtab) {
« no previous file with comments | « no previous file | content/browser/android/draw_delegate_impl.h » ('j') | content/browser/renderer_host/compositor_impl_android.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698