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

Side by Side Diff: content/common/gpu/client/context_provider_command_buffer.cc

Issue 1880823004: Move skia related files from content/common/gpu/client to gpu/skia_bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 4 years, 8 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/common/gpu/client/context_provider_command_buffer.h" 5 #include "content/common/gpu/client/context_provider_command_buffer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/callback_helpers.h" 12 #include "base/callback_helpers.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 #include "cc/output/managed_memory_policy.h" 14 #include "cc/output/managed_memory_policy.h"
15 #include "content/common/gpu/client/grcontext_for_gles2_interface.h"
16 #include "gpu/command_buffer/client/gles2_implementation.h" 15 #include "gpu/command_buffer/client/gles2_implementation.h"
16 #include "gpu/skia_bindings/grcontext_for_gles2_interface.h"
17 #include "third_party/skia/include/gpu/GrContext.h" 17 #include "third_party/skia/include/gpu/GrContext.h"
18 18
19 namespace content { 19 namespace content {
20 20
21 class ContextProviderCommandBuffer::LostContextCallbackProxy 21 class ContextProviderCommandBuffer::LostContextCallbackProxy
22 : public blink::WebGraphicsContext3D::WebGraphicsContextLostCallback { 22 : public blink::WebGraphicsContext3D::WebGraphicsContextLostCallback {
23 public: 23 public:
24 explicit LostContextCallbackProxy(ContextProviderCommandBuffer* provider) 24 explicit LostContextCallbackProxy(ContextProviderCommandBuffer* provider)
25 : provider_(provider) { 25 : provider_(provider) {
26 provider_->context3d_->setContextLostCallback(this); 26 provider_->context3d_->setContextLostCallback(this);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 return context3d_->GetContextSupport(); 119 return context3d_->GetContextSupport();
120 } 120 }
121 121
122 class GrContext* ContextProviderCommandBuffer::GrContext() { 122 class GrContext* ContextProviderCommandBuffer::GrContext() {
123 DCHECK(lost_context_callback_proxy_); // Is bound to thread. 123 DCHECK(lost_context_callback_proxy_); // Is bound to thread.
124 DCHECK(context_thread_checker_.CalledOnValidThread()); 124 DCHECK(context_thread_checker_.CalledOnValidThread());
125 125
126 if (gr_context_) 126 if (gr_context_)
127 return gr_context_->get(); 127 return gr_context_->get();
128 128
129 gr_context_.reset( 129 gr_context_.reset(new skia_bindings::GrContextForGLES2Interface(
130 new GrContextForGLES2Interface(context3d_->GetGLInterface())); 130 context3d_->GetGLInterface()));
131 131
132 // If GlContext is already lost, also abandon the new GrContext. 132 // If GlContext is already lost, also abandon the new GrContext.
133 if (gr_context_->get() && 133 if (gr_context_->get() &&
134 ContextGL()->GetGraphicsResetStatusKHR() != GL_NO_ERROR) 134 ContextGL()->GetGraphicsResetStatusKHR() != GL_NO_ERROR)
135 gr_context_->get()->abandonContext(); 135 gr_context_->get()->abandonContext();
136 136
137 return gr_context_->get(); 137 return gr_context_->get();
138 } 138 }
139 139
140 void ContextProviderCommandBuffer::InvalidateGrContext(uint32_t state) { 140 void ContextProviderCommandBuffer::InvalidateGrContext(uint32_t state) {
141 if (gr_context_) { 141 if (gr_context_) {
142 DCHECK(lost_context_callback_proxy_); // Is bound to thread. 142 DCHECK(lost_context_callback_proxy_); // Is bound to thread.
143 DCHECK(context_thread_checker_.CalledOnValidThread()); 143 DCHECK(context_thread_checker_.CalledOnValidThread());
144 gr_context_->get()->resetContext(state); 144 gr_context_->ResetContext(state);
145 } 145 }
146 } 146 }
147 147
148 void ContextProviderCommandBuffer::SetupLock() { 148 void ContextProviderCommandBuffer::SetupLock() {
149 DCHECK(context3d_); 149 DCHECK(context3d_);
150 context3d_->GetCommandBufferProxy()->SetLock(&context_lock_); 150 context3d_->GetCommandBufferProxy()->SetLock(&context_lock_);
151 } 151 }
152 152
153 base::Lock* ContextProviderCommandBuffer::GetLock() { 153 base::Lock* ContextProviderCommandBuffer::GetLock() {
154 return &context_lock_; 154 return &context_lock_;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 192
193 void ContextProviderCommandBuffer::SetLostContextCallback( 193 void ContextProviderCommandBuffer::SetLostContextCallback(
194 const LostContextCallback& lost_context_callback) { 194 const LostContextCallback& lost_context_callback) {
195 DCHECK(context_thread_checker_.CalledOnValidThread()); 195 DCHECK(context_thread_checker_.CalledOnValidThread());
196 DCHECK(lost_context_callback_.is_null() || 196 DCHECK(lost_context_callback_.is_null() ||
197 lost_context_callback.is_null()); 197 lost_context_callback.is_null());
198 lost_context_callback_ = lost_context_callback; 198 lost_context_callback_ = lost_context_callback;
199 } 199 }
200 200
201 } // namespace content 201 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/context_provider_command_buffer.h ('k') | content/common/gpu/client/grcontext_for_gles2_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698