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

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

Issue 349653004: Merge 279934 "aw: Fix hardware teardown race" (Closed) Base URL: svn://svn.chromium.org/chrome/branches/2062/src/
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « android_webview/browser/shared_renderer_state.h ('k') | android_webview/native/aw_contents.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() : 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 hardware_allowed_(false),
27 hardware_initialized_(false),
28 share_context_(NULL) { 27 share_context_(NULL) {
29 DCHECK(ui_loop_->BelongsToCurrentThread()); 28 DCHECK(ui_loop_->BelongsToCurrentThread());
30 DCHECK(client_on_ui_); 29 DCHECK(client_on_ui_);
31 } 30 }
32 31
33 SharedRendererState::~SharedRendererState() {} 32 SharedRendererState::~SharedRendererState() {}
34 33
35 void SharedRendererState::ClientRequestDrawGL() { 34 void SharedRendererState::ClientRequestDrawGL() {
36 if (ui_loop_->BelongsToCurrentThread()) { 35 if (ui_loop_->BelongsToCurrentThread()) {
37 ClientRequestDrawGLOnUIThread(); 36 ClientRequestDrawGLOnUIThread();
(...skipping 26 matching lines...) Expand all
64 void SharedRendererState::SetHardwareAllowed(bool allowed) { 63 void SharedRendererState::SetHardwareAllowed(bool allowed) {
65 base::AutoLock lock(lock_); 64 base::AutoLock lock(lock_);
66 hardware_allowed_ = allowed; 65 hardware_allowed_ = allowed;
67 } 66 }
68 67
69 bool SharedRendererState::IsHardwareAllowed() const { 68 bool SharedRendererState::IsHardwareAllowed() const {
70 base::AutoLock lock(lock_); 69 base::AutoLock lock(lock_);
71 return hardware_allowed_; 70 return hardware_allowed_;
72 } 71 }
73 72
74 void SharedRendererState::SetHardwareInitialized(bool initialized) {
75 base::AutoLock lock(lock_);
76 hardware_initialized_ = initialized;
77 }
78
79 bool SharedRendererState::IsHardwareInitialized() const {
80 base::AutoLock lock(lock_);
81 return hardware_initialized_;
82 }
83
84 void SharedRendererState::SetSharedContext(gpu::GLInProcessContext* context) { 73 void SharedRendererState::SetSharedContext(gpu::GLInProcessContext* context) {
85 base::AutoLock lock(lock_); 74 base::AutoLock lock(lock_);
86 DCHECK(!share_context_ || !context); 75 DCHECK(!share_context_ || !context);
87 share_context_ = context; 76 share_context_ = context;
88 } 77 }
89 78
90 gpu::GLInProcessContext* SharedRendererState::GetSharedContext() const { 79 gpu::GLInProcessContext* SharedRendererState::GetSharedContext() const {
91 base::AutoLock lock(lock_); 80 base::AutoLock lock(lock_);
92 DCHECK(share_context_); 81 DCHECK(share_context_);
93 return share_context_; 82 return share_context_;
(...skipping 17 matching lines...) Expand all
111 base::AutoLock lock(lock_); 100 base::AutoLock lock(lock_);
112 resources->swap(returned_resources_); 101 resources->swap(returned_resources_);
113 } 102 }
114 103
115 bool SharedRendererState::ReturnedResourcesEmpty() const { 104 bool SharedRendererState::ReturnedResourcesEmpty() const {
116 base::AutoLock lock(lock_); 105 base::AutoLock lock(lock_);
117 return returned_resources_.empty(); 106 return returned_resources_.empty();
118 } 107 }
119 108
120 } // namespace android_webview 109 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/shared_renderer_state.h ('k') | android_webview/native/aw_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698