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

Unified Diff: content/browser/renderer_host/compositor_impl_android.h

Issue 10828356: Very basic Android browser-side compositing support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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: content/browser/renderer_host/compositor_impl_android.h
diff --git a/content/browser/renderer_host/compositor_impl_android.h b/content/browser/renderer_host/compositor_impl_android.h
new file mode 100644
index 0000000000000000000000000000000000000000..fd1aa0cd2ffa4d67c1f4cc06cd9632aea86a409e
--- /dev/null
+++ b/content/browser/renderer_host/compositor_impl_android.h
@@ -0,0 +1,73 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_
+#define CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "content/public/browser/android/compositor.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewClient.h"
+
+struct ANativeWindow;
+
+namespace content {
+class GraphicsContext;
+class RenderWidgetHostView;
+
+// -----------------------------------------------------------------------------
+// Browser-side compositor that manages a tree of content and UI layers.
+// -----------------------------------------------------------------------------
+class CompositorImpl : public Compositor,
+ public WebKit::WebLayerTreeViewClient {
+ public:
+ CompositorImpl();
+ virtual ~CompositorImpl();
+
+ static CompositorImpl* GetInstance();
+
+ // Compositor implementation.
+ virtual void SetRootLayer(const WebKit::WebLayer& root) OVERRIDE;
+ virtual void SetWindowSurface(ANativeWindow* window) OVERRIDE;
+ virtual void SetWindowBounds(const gfx::Size& size) OVERRIDE;
+
+ // WebLayerTreeViewClient implementation.
+ virtual void updateAnimations(double frameBeginTime) OVERRIDE;
+ virtual void layout() OVERRIDE;
+ virtual void applyScrollAndScale(const WebKit::WebSize& scrollDelta,
+ float scaleFactor) OVERRIDE;
+ virtual WebKit::WebGraphicsContext3D* createContext3D() OVERRIDE;
+ virtual void didRebindGraphicsContext(bool success) OVERRIDE;
+ virtual void didCommit() OVERRIDE;
+ virtual void didCommitAndDrawFrame() OVERRIDE;
+ virtual void didCompleteSwapBuffers() OVERRIDE;
+ virtual void scheduleComposite() OVERRIDE;
+
+ // Callback to be run after the frame has been drawn. It passes back
+ // a synchronization point identifier.
+ typedef base::Callback<void(uint32)> SurfacePresentedCallback;
+
+ void SurfaceUpdated(const SurfacePresentedCallback& callback);
+ void SetCompositorSurface(gfx::GLSurfaceHandle handle) { handle_ = handle; }
+ gfx::Size GetWindowBounds() { return size_; }
+ gfx::GLSurfaceHandle GetCompositorSurface() { return handle_; }
+
+ private:
+ WebKit::WebLayer root_layer_;
+ WebKit::WebLayerTreeView host_;
+
+ scoped_ptr<GraphicsContext> context_;
+
+ gfx::GLSurfaceHandle handle_;
+ gfx::Size size_;
+
+ DISALLOW_COPY_AND_ASSIGN(CompositorImpl);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_IMPL_ANDROID_H_

Powered by Google App Engine
This is Rietveld 408576698