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

Side by Side Diff: android_webview/browser/shared_renderer_state.cc

Issue 540143002: InProcessGL: Share MailboxManager per service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@clankium
Patch Set: rebase Created 6 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "android_webview/browser/shared_renderer_state.h" 5 #include "android_webview/browser/shared_renderer_state.h"
6 6
7 #include "android_webview/browser/browser_view_renderer_client.h" 7 #include "android_webview/browser/browser_view_renderer_client.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 DrawGLInput::~DrawGLInput() { 73 DrawGLInput::~DrawGLInput() {
74 } 74 }
75 75
76 SharedRendererState::SharedRendererState( 76 SharedRendererState::SharedRendererState(
77 scoped_refptr<base::MessageLoopProxy> ui_loop, 77 scoped_refptr<base::MessageLoopProxy> ui_loop,
78 BrowserViewRendererClient* client) 78 BrowserViewRendererClient* client)
79 : ui_loop_(ui_loop), 79 : ui_loop_(ui_loop),
80 client_on_ui_(client), 80 client_on_ui_(client),
81 weak_factory_on_ui_thread_(this), 81 weak_factory_on_ui_thread_(this),
82 ui_thread_weak_ptr_(weak_factory_on_ui_thread_.GetWeakPtr()), 82 ui_thread_weak_ptr_(weak_factory_on_ui_thread_.GetWeakPtr()),
83 inside_hardware_release_(false), 83 inside_hardware_release_(false) {
84 share_context_(NULL) {
85 DCHECK(ui_loop_->BelongsToCurrentThread()); 84 DCHECK(ui_loop_->BelongsToCurrentThread());
86 DCHECK(client_on_ui_); 85 DCHECK(client_on_ui_);
87 ResetRequestDrawGLCallback(); 86 ResetRequestDrawGLCallback();
88 } 87 }
89 88
90 SharedRendererState::~SharedRendererState() { 89 SharedRendererState::~SharedRendererState() {
91 DCHECK(ui_loop_->BelongsToCurrentThread()); 90 DCHECK(ui_loop_->BelongsToCurrentThread());
92 } 91 }
93 92
94 void SharedRendererState::ClientRequestDrawGL() { 93 void SharedRendererState::ClientRequestDrawGL() {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 void SharedRendererState::SetInsideHardwareRelease(bool inside) { 171 void SharedRendererState::SetInsideHardwareRelease(bool inside) {
173 base::AutoLock lock(lock_); 172 base::AutoLock lock(lock_);
174 inside_hardware_release_ = inside; 173 inside_hardware_release_ = inside;
175 } 174 }
176 175
177 bool SharedRendererState::IsInsideHardwareRelease() const { 176 bool SharedRendererState::IsInsideHardwareRelease() const {
178 base::AutoLock lock(lock_); 177 base::AutoLock lock(lock_);
179 return inside_hardware_release_; 178 return inside_hardware_release_;
180 } 179 }
181 180
182 void SharedRendererState::SetSharedContext(gpu::GLInProcessContext* context) {
183 base::AutoLock lock(lock_);
184 DCHECK(!share_context_ || !context);
185 share_context_ = context;
186 }
187
188 gpu::GLInProcessContext* SharedRendererState::GetSharedContext() const {
189 base::AutoLock lock(lock_);
190 DCHECK(share_context_);
191 return share_context_;
192 }
193
194 void SharedRendererState::InsertReturnedResources( 181 void SharedRendererState::InsertReturnedResources(
195 const cc::ReturnedResourceArray& resources) { 182 const cc::ReturnedResourceArray& resources) {
196 base::AutoLock lock(lock_); 183 base::AutoLock lock(lock_);
197 returned_resources_.insert( 184 returned_resources_.insert(
198 returned_resources_.end(), resources.begin(), resources.end()); 185 returned_resources_.end(), resources.begin(), resources.end());
199 } 186 }
200 187
201 void SharedRendererState::SwapReturnedResources( 188 void SharedRendererState::SwapReturnedResources(
202 cc::ReturnedResourceArray* resources) { 189 cc::ReturnedResourceArray* resources) {
203 DCHECK(resources->empty()); 190 DCHECK(resources->empty());
(...skipping 11 matching lines...) Expand all
215 : shared_renderer_state_(shared_renderer_state) { 202 : shared_renderer_state_(shared_renderer_state) {
216 DCHECK(!shared_renderer_state_->IsInsideHardwareRelease()); 203 DCHECK(!shared_renderer_state_->IsInsideHardwareRelease());
217 shared_renderer_state_->SetInsideHardwareRelease(true); 204 shared_renderer_state_->SetInsideHardwareRelease(true);
218 } 205 }
219 206
220 InsideHardwareReleaseReset::~InsideHardwareReleaseReset() { 207 InsideHardwareReleaseReset::~InsideHardwareReleaseReset() {
221 shared_renderer_state_->SetInsideHardwareRelease(false); 208 shared_renderer_state_->SetInsideHardwareRelease(false);
222 } 209 }
223 210
224 } // namespace android_webview 211 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698