Chromium Code Reviews| 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() : frame_id(0), width(0), height(0) {} | 13 DrawGLInput::DrawGLInput() : frame_id(0), width(0), height(0) {} |
| 14 | 14 |
| 15 DrawGLResult::DrawGLResult() : frame_id(0), clip_contains_visible_rect(false) {} | 15 DrawGLResult::DrawGLResult() : frame_id(0), clip_contains_visible_rect(false) {} |
| 16 | 16 |
| 17 SharedRendererState::SharedRendererState( | 17 SharedRendererState::SharedRendererState( |
| 18 scoped_refptr<base::MessageLoopProxy> ui_loop, | 18 scoped_refptr<base::MessageLoopProxy> ui_loop, |
| 19 BrowserViewRendererClient* client) | 19 BrowserViewRendererClient* client) |
| 20 : ui_loop_(ui_loop), | 20 : ui_loop_(ui_loop), |
| 21 client_on_ui_(client), | 21 client_on_ui_(client), |
| 22 weak_factory_on_ui_thread_(this), | 22 weak_factory_on_ui_thread_(this), |
| 23 ui_thread_weak_ptr_(weak_factory_on_ui_thread_.GetWeakPtr()) { | 23 ui_thread_weak_ptr_(weak_factory_on_ui_thread_.GetWeakPtr()) { |
|
boliu
2014/05/01 00:37:40
initialize dirty var
hush (inactive)
2014/05/01 19:03:04
Done.
| |
| 24 DCHECK(ui_loop_->BelongsToCurrentThread()); | 24 DCHECK(ui_loop_->BelongsToCurrentThread()); |
| 25 DCHECK(client_on_ui_); | 25 DCHECK(client_on_ui_); |
| 26 } | 26 } |
| 27 | 27 |
| 28 SharedRendererState::~SharedRendererState() {} | 28 SharedRendererState::~SharedRendererState() {} |
| 29 | 29 |
| 30 void SharedRendererState::ClientRequestDrawGL() { | 30 void SharedRendererState::ClientRequestDrawGL() { |
| 31 if (ui_loop_->BelongsToCurrentThread()) { | 31 if (ui_loop_->BelongsToCurrentThread()) { |
| 32 ClientRequestDrawGLOnUIThread(); | 32 ClientRequestDrawGLOnUIThread(); |
| 33 } else { | 33 } else { |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 49 content::SynchronousCompositor* compositor) { | 49 content::SynchronousCompositor* compositor) { |
| 50 DCHECK(ui_loop_->BelongsToCurrentThread()); | 50 DCHECK(ui_loop_->BelongsToCurrentThread()); |
| 51 compositor_ = compositor; | 51 compositor_ = compositor; |
| 52 } | 52 } |
| 53 | 53 |
| 54 content::SynchronousCompositor* SharedRendererState::GetCompositor() { | 54 content::SynchronousCompositor* SharedRendererState::GetCompositor() { |
| 55 DCHECK(compositor_); | 55 DCHECK(compositor_); |
| 56 return compositor_; | 56 return compositor_; |
| 57 } | 57 } |
| 58 | 58 |
| 59 void SharedRendererState::SetMemoryPolicy( | |
| 60 const content::SynchronousCompositorMemoryPolicy new_policy) { | |
| 61 if (memory_policy_ != new_policy) { | |
| 62 memory_policy_ = new_policy; | |
| 63 memory_policy_dirty_ = true; | |
| 64 } | |
| 65 } | |
| 66 | |
| 67 content::SynchronousCompositorMemoryPolicy | |
| 68 SharedRendererState::GetMemoryPolicy() const { | |
| 69 return memory_policy_; | |
| 70 } | |
| 71 | |
| 59 void SharedRendererState::SetDrawGLInput(const DrawGLInput& input) { | 72 void SharedRendererState::SetDrawGLInput(const DrawGLInput& input) { |
| 60 draw_gl_input_ = input; | 73 draw_gl_input_ = input; |
| 61 } | 74 } |
| 62 | 75 |
| 63 DrawGLInput SharedRendererState::GetDrawGLInput() const { | 76 DrawGLInput SharedRendererState::GetDrawGLInput() const { |
| 64 return draw_gl_input_; | 77 return draw_gl_input_; |
| 65 } | 78 } |
| 66 | 79 |
| 80 void SharedRendererState::SetMemoryPolicyDirty(bool is_dirty) { | |
| 81 memory_policy_dirty_ = is_dirty; | |
| 82 } | |
| 83 | |
| 84 bool SharedRendererState::IsMemoryPolicyDirty() const { | |
| 85 return memory_policy_dirty_; | |
| 86 } | |
| 87 | |
| 67 } // namespace android_webview | 88 } // namespace android_webview |
| OLD | NEW |