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

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

Issue 226363004: Global GPU memory manager for android webview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address Bo's comments 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 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/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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698