| OLD | NEW |
| 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 | |
| 9 #include <set> | 8 #include <set> |
| 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_webgraphicscontext3d.h" | 15 #include "content/common/gpu/client/grcontext_for_webgraphicscontext3d.h" |
| 16 #include "gpu/command_buffer/client/gles2_implementation.h" | 16 #include "gpu/command_buffer/client/gles2_implementation.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 { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 36 ContextProviderCommandBuffer* provider_; | 36 ContextProviderCommandBuffer* provider_; |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 scoped_refptr<ContextProviderCommandBuffer> | 39 scoped_refptr<ContextProviderCommandBuffer> |
| 40 ContextProviderCommandBuffer::Create( | 40 ContextProviderCommandBuffer::Create( |
| 41 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d, | 41 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d, |
| 42 CommandBufferContextType type) { | 42 CommandBufferContextType type) { |
| 43 if (!context3d) | 43 if (!context3d) |
| 44 return NULL; | 44 return NULL; |
| 45 | 45 |
| 46 return new ContextProviderCommandBuffer(context3d.Pass(), type); | 46 return new ContextProviderCommandBuffer(std::move(context3d), type); |
| 47 } | 47 } |
| 48 | 48 |
| 49 ContextProviderCommandBuffer::ContextProviderCommandBuffer( | 49 ContextProviderCommandBuffer::ContextProviderCommandBuffer( |
| 50 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d, | 50 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d, |
| 51 CommandBufferContextType type) | 51 CommandBufferContextType type) |
| 52 : context_type_(type), | 52 : context_type_(type), |
| 53 debug_name_(CommandBufferContextTypeToString(type)) { | 53 debug_name_(CommandBufferContextTypeToString(type)) { |
| 54 gr_interface_ = skia::AdoptRef(new GrGLInterfaceForWebGraphicsContext3D( | 54 gr_interface_ = skia::AdoptRef( |
| 55 context3d.Pass())); | 55 new GrGLInterfaceForWebGraphicsContext3D(std::move(context3d))); |
| 56 DCHECK(main_thread_checker_.CalledOnValidThread()); | 56 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 57 DCHECK(gr_interface_->WebContext3D()); | 57 DCHECK(gr_interface_->WebContext3D()); |
| 58 context_thread_checker_.DetachFromThread(); | 58 context_thread_checker_.DetachFromThread(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 ContextProviderCommandBuffer::~ContextProviderCommandBuffer() { | 61 ContextProviderCommandBuffer::~ContextProviderCommandBuffer() { |
| 62 DCHECK(main_thread_checker_.CalledOnValidThread() || | 62 DCHECK(main_thread_checker_.CalledOnValidThread() || |
| 63 context_thread_checker_.CalledOnValidThread()); | 63 context_thread_checker_.CalledOnValidThread()); |
| 64 | 64 |
| 65 // Destroy references to the context3d_ before leaking it. | 65 // Destroy references to the context3d_ before leaking it. |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 199 |
| 200 void ContextProviderCommandBuffer::SetLostContextCallback( | 200 void ContextProviderCommandBuffer::SetLostContextCallback( |
| 201 const LostContextCallback& lost_context_callback) { | 201 const LostContextCallback& lost_context_callback) { |
| 202 DCHECK(context_thread_checker_.CalledOnValidThread()); | 202 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 203 DCHECK(lost_context_callback_.is_null() || | 203 DCHECK(lost_context_callback_.is_null() || |
| 204 lost_context_callback.is_null()); | 204 lost_context_callback.is_null()); |
| 205 lost_context_callback_ = lost_context_callback; | 205 lost_context_callback_ = lost_context_callback; |
| 206 } | 206 } |
| 207 | 207 |
| 208 } // namespace content | 208 } // namespace content |
| OLD | NEW |