summaryrefslogtreecommitdiffstats
path: root/content/public/browser
diff options
context:
space:
mode:
authorsievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-01 00:16:46 +0000
committersievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-01 00:16:46 +0000
commit15c0ba4241581b49a7241ed9081840307a66b0d1 (patch)
treefadea6e555b19b1bfe68cb5c5a22c73c40166e89 /content/public/browser
parentedec252702b2027ebe5564746c1582b7dd4e9752 (diff)
downloadchromium_src-15c0ba4241581b49a7241ed9081840307a66b0d1.zip
chromium_src-15c0ba4241581b49a7241ed9081840307a66b0d1.tar.gz
chromium_src-15c0ba4241581b49a7241ed9081840307a66b0d1.tar.bz2
ContentShell rendering support on Android.
This renders to a SurfaceView using texture sharing on the GPU thread. There is a bit of a public interface added to let the app create a cmdbuffer (we want run GL contexts on the same thread when sharing resources on Android) and perform the handshaking needed for sharing the two compositor buffers. It has bugs, such as that it doesn't handle it yet when the UI surface handle changes (e.g. when hiding and restoring the app). BUG=136923 Review URL: https://chromiumcodereview.appspot.com/10823051 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149327 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/public/browser')
-rw-r--r--content/public/browser/android/draw_delegate.h41
-rw-r--r--content/public/browser/android/graphics_context.h31
2 files changed, 72 insertions, 0 deletions
diff --git a/content/public/browser/android/draw_delegate.h b/content/public/browser/android/draw_delegate.h
new file mode 100644
index 0000000..b1a8eff
--- /dev/null
+++ b/content/public/browser/android/draw_delegate.h
@@ -0,0 +1,41 @@
+// 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_PUBLIC_BROWSER_ANDROID_DRAW_DELEGATE_H_
+#define CONTENT_PUBLIC_BROWSER_ANDROID_DRAW_DELEGATE_H_
+
+#include "base/callback.h"
+#include "ui/gfx/native_widget_types.h"
+#include "ui/gfx/size.h"
+
+namespace content {
+
+class RenderWidgetHostView;
+
+// This interface facilitates the communication between compositor and
+// UI with respect to new frames arriving and acknowledging when they
+// have been presented.
+class DrawDelegate {
+ public:
+ static DrawDelegate* GetInstance();
+ virtual ~DrawDelegate() { }
+
+ // Callback to be run after the frame has been drawn. It passes back
+ // a synchronization point identifier.
+ typedef base::Callback<void(uint32)> SurfacePresentedCallback;
+
+ // Notification to the UI that the surface identified by the texture id
+ // has been updated.
+ typedef base::Callback<void(
+ uint64,
+ RenderWidgetHostView*,
+ const SurfacePresentedCallback&)> SurfaceUpdatedCallback;
+
+ virtual void SetUpdateCallback(const SurfaceUpdatedCallback& callback) = 0;
+ virtual void SetBounds(const gfx::Size& size) = 0;
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_BROWSER_ANDROID_DRAW_DELEGATE_H_
diff --git a/content/public/browser/android/graphics_context.h b/content/public/browser/android/graphics_context.h
new file mode 100644
index 0000000..a8d8285
--- /dev/null
+++ b/content/public/browser/android/graphics_context.h
@@ -0,0 +1,31 @@
+// 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_PUBLIC_BROWSER_ANDROID_GRAPHICS_CONTEXT_H_
+#define CONTENT_PUBLIC_BROWSER_ANDROID_GRAPHICS_CONTEXT_H_
+
+#include "ui/gfx/native_widget_types.h"
+
+struct ANativeWindow;
+
+namespace WebKit {
+class WebGraphicsContext3D;
+}
+
+namespace content {
+
+class GraphicsContext {
+ public:
+ virtual ~GraphicsContext() { }
+
+ // Create a UI graphics context that renders to the given surface.
+ static GraphicsContext* CreateForUI(ANativeWindow* ui_window);
+
+ virtual WebKit::WebGraphicsContext3D* GetContext3D() = 0;
+ virtual uint32 InsertSyncPoint() = 0;
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_BROWSER_ANDROID_GRAPHICS_CONTEXT_H_