| OLD | NEW |
| 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/location.h" | 9 #include "base/location.h" |
| 10 | 10 |
| 11 namespace android_webview { | 11 namespace android_webview { |
| 12 | 12 |
| 13 DrawGLInput::DrawGLInput() : width(0), height(0) { | 13 DrawGLInput::DrawGLInput() : width(0), height(0) { |
| 14 } | 14 } |
| 15 | 15 |
| 16 DrawGLInput::~DrawGLInput() { | 16 DrawGLInput::~DrawGLInput() { |
| 17 } | 17 } |
| 18 | 18 |
| 19 SharedRendererState::SharedRendererState( | 19 SharedRendererState::SharedRendererState( |
| 20 scoped_refptr<base::MessageLoopProxy> ui_loop, | 20 scoped_refptr<base::MessageLoopProxy> ui_loop, |
| 21 BrowserViewRendererClient* client) | 21 BrowserViewRendererClient* client) |
| 22 : ui_loop_(ui_loop), | 22 : ui_loop_(ui_loop), |
| 23 client_on_ui_(client), | 23 client_on_ui_(client), |
| 24 weak_factory_on_ui_thread_(this), | 24 weak_factory_on_ui_thread_(this), |
| 25 ui_thread_weak_ptr_(weak_factory_on_ui_thread_.GetWeakPtr()), | 25 ui_thread_weak_ptr_(weak_factory_on_ui_thread_.GetWeakPtr()), |
| 26 hardware_allowed_(false), | 26 inside_hardware_release_(false), |
| 27 share_context_(NULL) { | 27 share_context_(NULL) { |
| 28 DCHECK(ui_loop_->BelongsToCurrentThread()); | 28 DCHECK(ui_loop_->BelongsToCurrentThread()); |
| 29 DCHECK(client_on_ui_); | 29 DCHECK(client_on_ui_); |
| 30 } | 30 } |
| 31 | 31 |
| 32 SharedRendererState::~SharedRendererState() { | 32 SharedRendererState::~SharedRendererState() { |
| 33 DCHECK(ui_loop_->BelongsToCurrentThread()); | 33 DCHECK(ui_loop_->BelongsToCurrentThread()); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void SharedRendererState::ClientRequestDrawGL() { | 36 void SharedRendererState::ClientRequestDrawGL() { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 55 base::AutoLock lock(lock_); | 55 base::AutoLock lock(lock_); |
| 56 DCHECK(!draw_gl_input_.get()); | 56 DCHECK(!draw_gl_input_.get()); |
| 57 draw_gl_input_ = input.Pass(); | 57 draw_gl_input_ = input.Pass(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 scoped_ptr<DrawGLInput> SharedRendererState::PassDrawGLInput() { | 60 scoped_ptr<DrawGLInput> SharedRendererState::PassDrawGLInput() { |
| 61 base::AutoLock lock(lock_); | 61 base::AutoLock lock(lock_); |
| 62 return draw_gl_input_.Pass(); | 62 return draw_gl_input_.Pass(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void SharedRendererState::SetHardwareAllowed(bool allowed) { | 65 void SharedRendererState::SetInsideHardwareRelease(bool inside) { |
| 66 base::AutoLock lock(lock_); | 66 base::AutoLock lock(lock_); |
| 67 hardware_allowed_ = allowed; | 67 inside_hardware_release_ = inside; |
| 68 } | 68 } |
| 69 | 69 |
| 70 bool SharedRendererState::IsHardwareAllowed() const { | 70 bool SharedRendererState::IsInsideHardwareRelease() const { |
| 71 base::AutoLock lock(lock_); | 71 base::AutoLock lock(lock_); |
| 72 return hardware_allowed_; | 72 return inside_hardware_release_; |
| 73 } | 73 } |
| 74 | 74 |
| 75 void SharedRendererState::SetSharedContext(gpu::GLInProcessContext* context) { | 75 void SharedRendererState::SetSharedContext(gpu::GLInProcessContext* context) { |
| 76 base::AutoLock lock(lock_); | 76 base::AutoLock lock(lock_); |
| 77 DCHECK(!share_context_ || !context); | 77 DCHECK(!share_context_ || !context); |
| 78 share_context_ = context; | 78 share_context_ = context; |
| 79 } | 79 } |
| 80 | 80 |
| 81 gpu::GLInProcessContext* SharedRendererState::GetSharedContext() const { | 81 gpu::GLInProcessContext* SharedRendererState::GetSharedContext() const { |
| 82 base::AutoLock lock(lock_); | 82 base::AutoLock lock(lock_); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 97 base::AutoLock lock(lock_); | 97 base::AutoLock lock(lock_); |
| 98 resources->swap(returned_resources_); | 98 resources->swap(returned_resources_); |
| 99 } | 99 } |
| 100 | 100 |
| 101 bool SharedRendererState::ReturnedResourcesEmpty() const { | 101 bool SharedRendererState::ReturnedResourcesEmpty() const { |
| 102 base::AutoLock lock(lock_); | 102 base::AutoLock lock(lock_); |
| 103 return returned_resources_.empty(); | 103 return returned_resources_.empty(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 } // namespace android_webview | 106 } // namespace android_webview |
| OLD | NEW |