summaryrefslogtreecommitdiffstats
path: root/android_webview/browser/shared_renderer_state.h
diff options
context:
space:
mode:
authorboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-24 01:16:19 +0000
committerboliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-24 01:16:19 +0000
commit8705654b9dca0ad235794da2d85fd67107ed9789 (patch)
tree999550e096e1bb5476db8cfda5109dddf5285984 /android_webview/browser/shared_renderer_state.h
parentd6cca23af08515770c2ba66d01a3851d3da21570 (diff)
downloadchromium_src-8705654b9dca0ad235794da2d85fd67107ed9789.zip
chromium_src-8705654b9dca0ad235794da2d85fd67107ed9789.tar.gz
chromium_src-8705654b9dca0ad235794da2d85fd67107ed9789.tar.bz2
[Android WebView] Implement delegated rendering for sync compositor
Modify content SynchronousCompositor related classes to support for content embedder to use delegated rendering. The embedder is responsible for creating the parent compositor. Essentially need to pass CompositorFrame and CompositorFrameAck between embedder and SynchronousCompositor. Also need to expose the share context so embedder can correctly initialize a context for parent compositor. In android_webview implemented parent compositor for delegated rendering while keeping the current direct renderer working, controlled by a command line switch. BrowserViewRenderer deals exclusively with SynchronousCompositor (the child). And HardwareRenderer deals exclusively with the parent compositor. The two share data through lock protected SharedRendererState. And all are coordinated by native AwContents. Direct rendering path is kept alive in HardwareRendererLegacy and code guarded by switches::UbercompEnabled. Direct rendering path remains the default. BUG=344087 Review URL: https://codereview.chromium.org/287993004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272668 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview/browser/shared_renderer_state.h')
-rw-r--r--android_webview/browser/shared_renderer_state.h30
1 files changed, 25 insertions, 5 deletions
diff --git a/android_webview/browser/shared_renderer_state.h b/android_webview/browser/shared_renderer_state.h
index 7959541..8350c9d 100644
--- a/android_webview/browser/shared_renderer_state.h
+++ b/android_webview/browser/shared_renderer_state.h
@@ -7,28 +7,38 @@
#include "base/message_loop/message_loop_proxy.h"
#include "base/synchronization/lock.h"
+#include "cc/output/compositor_frame.h"
+#include "cc/output/compositor_frame_ack.h"
#include "content/public/browser/android/synchronous_compositor.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/vector2d.h"
+namespace cc {
+class CompositorFrameAck;
+}
+
+namespace gpu {
+class GLInProcessContext;
+}
+
namespace android_webview {
class BrowserViewRendererClient;
// Set by BrowserViewRenderer and read by HardwareRenderer.
struct DrawGLInput {
- unsigned int frame_id;
gfx::Rect global_visible_rect;
gfx::Vector2d scroll_offset;
int width;
int height;
+ cc::CompositorFrame frame;
DrawGLInput();
+ ~DrawGLInput();
};
// Set by HardwareRenderer and read by BrowserViewRenderer.
struct DrawGLResult {
- unsigned int frame_id;
bool clip_contains_visible_rect;
DrawGLResult();
@@ -58,8 +68,8 @@ class SharedRendererState {
void SetMemoryPolicyDirty(bool is_dirty);
bool IsMemoryPolicyDirty() const;
- void SetDrawGLInput(const DrawGLInput& input);
- DrawGLInput GetDrawGLInput() const;
+ void SetDrawGLInput(scoped_ptr<DrawGLInput> input);
+ scoped_ptr<DrawGLInput> PassDrawGLInput();
// Set by UI and read by RT.
void SetHardwareAllowed(bool allowed);
@@ -69,6 +79,14 @@ class SharedRendererState {
void SetHardwareInitialized(bool initialized);
bool IsHardwareInitialized() const;
+ void SetSharedContext(gpu::GLInProcessContext* context);
+ gpu::GLInProcessContext* GetSharedContext() const;
+
+ void ReturnResources(const cc::TransferableResourceArray& input);
+ void InsertReturnedResources(const cc::ReturnedResourceArray& resources);
+ void SwapReturnedResources(cc::ReturnedResourceArray* resources);
+ bool ReturnedResourcesEmpty() const;
+
private:
void ClientRequestDrawGLOnUIThread();
@@ -85,9 +103,11 @@ class SharedRendererState {
// Set to true when SetMemoryPolicy called with a different memory policy.
// Set to false when memory policy is read and enforced to compositor.
bool memory_policy_dirty_;
- DrawGLInput draw_gl_input_;
+ scoped_ptr<DrawGLInput> draw_gl_input_;
bool hardware_allowed_;
bool hardware_initialized_;
+ gpu::GLInProcessContext* share_context_;
+ cc::ReturnedResourceArray returned_resources_;
};
} // namespace android_webview