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

Unified Diff: android_webview/browser/shared_renderer_state.cc

Issue 287993004: [Android WebView] Implement Ubercomp for Render Thread support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: init tear down factored out separately 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 side-by-side diff with in-line comments
Download patch
Index: android_webview/browser/shared_renderer_state.cc
diff --git a/android_webview/browser/shared_renderer_state.cc b/android_webview/browser/shared_renderer_state.cc
index 193eca045ddcc0eb53f1e0b2f3f370c0c27263e6..42a42450ac46d8f87f8fddd6295c36f088001f57 100644
--- a/android_webview/browser/shared_renderer_state.cc
+++ b/android_webview/browser/shared_renderer_state.cc
@@ -10,9 +10,14 @@
namespace android_webview {
-DrawGLInput::DrawGLInput() : frame_id(0), width(0), height(0) {}
+DrawGLInput::DrawGLInput() : width(0), height(0) {
+}
+
+DrawGLInput::~DrawGLInput() {
+}
-DrawGLResult::DrawGLResult() : frame_id(0), clip_contains_visible_rect(false) {}
+DrawGLResult::DrawGLResult() : clip_contains_visible_rect(false) {
+}
SharedRendererState::SharedRendererState(
scoped_refptr<base::MessageLoopProxy> ui_loop,
@@ -24,7 +29,8 @@ SharedRendererState::SharedRendererState(
compositor_(NULL),
memory_policy_dirty_(false),
hardware_allowed_(false),
- hardware_initialized_(false) {
+ hardware_initialized_(false),
+ share_context_(NULL) {
DCHECK(ui_loop_->BelongsToCurrentThread());
DCHECK(client_on_ui_);
}
@@ -77,14 +83,15 @@ SharedRendererState::GetMemoryPolicy() const {
return memory_policy_;
}
-void SharedRendererState::SetDrawGLInput(const DrawGLInput& input) {
+void SharedRendererState::SetDrawGLInput(scoped_ptr<DrawGLInput> input) {
base::AutoLock lock(lock_);
- draw_gl_input_ = input;
+ DCHECK(!draw_gl_input_.get());
+ draw_gl_input_ = input.Pass();
}
-DrawGLInput SharedRendererState::GetDrawGLInput() const {
+scoped_ptr<DrawGLInput> SharedRendererState::PassDrawGLInput() {
base::AutoLock lock(lock_);
- return draw_gl_input_;
+ return draw_gl_input_.Pass();
}
void SharedRendererState::SetHardwareAllowed(bool allowed) {
@@ -107,6 +114,18 @@ bool SharedRendererState::IsHardwareInitialized() const {
return hardware_initialized_;
}
+void SharedRendererState::SetSharedContext(gpu::GLInProcessContext* context) {
+ base::AutoLock lock(lock_);
+ DCHECK(!share_context_ || !context);
+ share_context_ = context;
+}
+
+gpu::GLInProcessContext* SharedRendererState::GetSharedContext() const {
+ base::AutoLock lock(lock_);
+ DCHECK(share_context_);
+ return share_context_;
+}
+
void SharedRendererState::SetMemoryPolicyDirty(bool is_dirty) {
base::AutoLock lock(lock_);
memory_policy_dirty_ = is_dirty;
@@ -117,4 +136,28 @@ bool SharedRendererState::IsMemoryPolicyDirty() const {
return memory_policy_dirty_;
}
+void SharedRendererState::ReturnResources(
+ const cc::TransferableResourceArray& input) {
+ base::AutoLock lock(lock_);
+ cc::TransferableResource::ReturnResources(input, &returned_resources_);
+}
+
+void SharedRendererState::InsertReturnedResources(
+ const cc::ReturnedResourceArray& resources) {
+ base::AutoLock lock(lock_);
+ returned_resources_.insert(
+ returned_resources_.end(), resources.begin(), resources.end());
+}
+
+void SharedRendererState::SwapReturnedResources(
+ cc::ReturnedResourceArray* resources) {
+ base::AutoLock lock(lock_);
+ resources->swap(returned_resources_);
+}
+
+bool SharedRendererState::ReturnedResourcesEmpty() const {
+ base::AutoLock lock(lock_);
+ return returned_resources_.empty();
+}
+
} // namespace android_webview

Powered by Google App Engine
This is Rietveld 408576698