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 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 } | 45 } |
46 | 46 |
47 void SharedRendererState::ClientRequestDrawGLOnUIThread() { | 47 void SharedRendererState::ClientRequestDrawGLOnUIThread() { |
48 DCHECK(ui_loop_->BelongsToCurrentThread()); | 48 DCHECK(ui_loop_->BelongsToCurrentThread()); |
49 if (!client_on_ui_->RequestDrawGL(NULL, false)) { | 49 if (!client_on_ui_->RequestDrawGL(NULL, false)) { |
50 LOG(ERROR) << "Failed to request GL process. Deadlock likely"; | 50 LOG(ERROR) << "Failed to request GL process. Deadlock likely"; |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
| 54 void SharedRendererState::UpdateParentDrawConstraintsOnUIThread() { |
| 55 DCHECK(ui_loop_->BelongsToCurrentThread()); |
| 56 client_on_ui_->UpdateParentDrawConstraints(); |
| 57 } |
| 58 |
54 void SharedRendererState::SetDrawGLInput(scoped_ptr<DrawGLInput> input) { | 59 void SharedRendererState::SetDrawGLInput(scoped_ptr<DrawGLInput> input) { |
55 base::AutoLock lock(lock_); | 60 base::AutoLock lock(lock_); |
56 DCHECK(!draw_gl_input_.get()); | 61 DCHECK(!draw_gl_input_.get()); |
57 draw_gl_input_ = input.Pass(); | 62 draw_gl_input_ = input.Pass(); |
58 } | 63 } |
59 | 64 |
60 scoped_ptr<DrawGLInput> SharedRendererState::PassDrawGLInput() { | 65 scoped_ptr<DrawGLInput> SharedRendererState::PassDrawGLInput() { |
61 base::AutoLock lock(lock_); | 66 base::AutoLock lock(lock_); |
62 return draw_gl_input_.Pass(); | 67 return draw_gl_input_.Pass(); |
63 } | 68 } |
64 | 69 |
| 70 void SharedRendererState::PostExternalDrawConstraintsToChildCompositor( |
| 71 const ParentCompositorDrawConstraints& parent_draw_constraints) { |
| 72 { |
| 73 base::AutoLock lock(lock_); |
| 74 parent_draw_constraints_ = parent_draw_constraints; |
| 75 } |
| 76 |
| 77 // No need to hold the lock_ during the post task. |
| 78 ui_loop_->PostTask( |
| 79 FROM_HERE, |
| 80 base::Bind(&SharedRendererState::UpdateParentDrawConstraintsOnUIThread, |
| 81 ui_thread_weak_ptr_)); |
| 82 } |
| 83 |
| 84 const ParentCompositorDrawConstraints |
| 85 SharedRendererState::ParentDrawConstraints() const { |
| 86 base::AutoLock lock(lock_); |
| 87 return parent_draw_constraints_; |
| 88 } |
| 89 |
65 void SharedRendererState::SetInsideHardwareRelease(bool inside) { | 90 void SharedRendererState::SetInsideHardwareRelease(bool inside) { |
66 base::AutoLock lock(lock_); | 91 base::AutoLock lock(lock_); |
67 inside_hardware_release_ = inside; | 92 inside_hardware_release_ = inside; |
68 } | 93 } |
69 | 94 |
70 bool SharedRendererState::IsInsideHardwareRelease() const { | 95 bool SharedRendererState::IsInsideHardwareRelease() const { |
71 base::AutoLock lock(lock_); | 96 base::AutoLock lock(lock_); |
72 return inside_hardware_release_; | 97 return inside_hardware_release_; |
73 } | 98 } |
74 | 99 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 : shared_renderer_state_(shared_renderer_state) { | 133 : shared_renderer_state_(shared_renderer_state) { |
109 DCHECK(!shared_renderer_state_->IsInsideHardwareRelease()); | 134 DCHECK(!shared_renderer_state_->IsInsideHardwareRelease()); |
110 shared_renderer_state_->SetInsideHardwareRelease(true); | 135 shared_renderer_state_->SetInsideHardwareRelease(true); |
111 } | 136 } |
112 | 137 |
113 InsideHardwareReleaseReset::~InsideHardwareReleaseReset() { | 138 InsideHardwareReleaseReset::~InsideHardwareReleaseReset() { |
114 shared_renderer_state_->SetInsideHardwareRelease(false); | 139 shared_renderer_state_->SetInsideHardwareRelease(false); |
115 } | 140 } |
116 | 141 |
117 } // namespace android_webview | 142 } // namespace android_webview |
OLD | NEW |