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/browser/android/in_process/context_provider_in_process.h" | 5 #include "content/browser/android/in_process/context_provider_in_process.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
11 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
12 #include "cc/output/managed_memory_policy.h" | 13 #include "cc/output/managed_memory_policy.h" |
13 #include "content/common/gpu/client/grcontext_for_webgraphicscontext3d.h" | 14 #include "content/common/gpu/client/grcontext_for_webgraphicscontext3d.h" |
14 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" | 15 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" |
15 #include "gpu/command_buffer/client/gles2_implementation.h" | 16 #include "gpu/command_buffer/client/gles2_implementation.h" |
16 #include "third_party/skia/include/gpu/GrContext.h" | 17 #include "third_party/skia/include/gpu/GrContext.h" |
17 | 18 |
(...skipping 20 matching lines...) Expand all Loading... |
38 private: | 39 private: |
39 ContextProviderInProcess* provider_; | 40 ContextProviderInProcess* provider_; |
40 }; | 41 }; |
41 | 42 |
42 // static | 43 // static |
43 scoped_refptr<ContextProviderInProcess> ContextProviderInProcess::Create( | 44 scoped_refptr<ContextProviderInProcess> ContextProviderInProcess::Create( |
44 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d, | 45 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d, |
45 const std::string& debug_name) { | 46 const std::string& debug_name) { |
46 if (!context3d) | 47 if (!context3d) |
47 return NULL; | 48 return NULL; |
48 return new ContextProviderInProcess(context3d.Pass(), debug_name); | 49 return new ContextProviderInProcess(std::move(context3d), debug_name); |
49 } | 50 } |
50 | 51 |
51 ContextProviderInProcess::ContextProviderInProcess( | 52 ContextProviderInProcess::ContextProviderInProcess( |
52 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d, | 53 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d, |
53 const std::string& debug_name) | 54 const std::string& debug_name) |
54 : debug_name_(debug_name) { | 55 : debug_name_(debug_name) { |
55 DCHECK(main_thread_checker_.CalledOnValidThread()); | 56 DCHECK(main_thread_checker_.CalledOnValidThread()); |
56 DCHECK(context3d); | 57 DCHECK(context3d); |
57 gr_interface_ = skia::AdoptRef(new GrGLInterfaceForWebGraphicsContext3D( | 58 gr_interface_ = skia::AdoptRef( |
58 context3d.Pass())); | 59 new GrGLInterfaceForWebGraphicsContext3D(std::move(context3d))); |
59 DCHECK(gr_interface_->WebContext3D()); | 60 DCHECK(gr_interface_->WebContext3D()); |
60 context_thread_checker_.DetachFromThread(); | 61 context_thread_checker_.DetachFromThread(); |
61 } | 62 } |
62 | 63 |
63 ContextProviderInProcess::~ContextProviderInProcess() { | 64 ContextProviderInProcess::~ContextProviderInProcess() { |
64 DCHECK(main_thread_checker_.CalledOnValidThread() || | 65 DCHECK(main_thread_checker_.CalledOnValidThread() || |
65 context_thread_checker_.CalledOnValidThread()); | 66 context_thread_checker_.CalledOnValidThread()); |
66 } | 67 } |
67 | 68 |
68 blink::WebGraphicsContext3D* ContextProviderInProcess::WebContext3D() { | 69 blink::WebGraphicsContext3D* ContextProviderInProcess::WebContext3D() { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 190 |
190 void ContextProviderInProcess::SetLostContextCallback( | 191 void ContextProviderInProcess::SetLostContextCallback( |
191 const LostContextCallback& lost_context_callback) { | 192 const LostContextCallback& lost_context_callback) { |
192 DCHECK(context_thread_checker_.CalledOnValidThread()); | 193 DCHECK(context_thread_checker_.CalledOnValidThread()); |
193 DCHECK(lost_context_callback_.is_null() || | 194 DCHECK(lost_context_callback_.is_null() || |
194 lost_context_callback.is_null()); | 195 lost_context_callback.is_null()); |
195 lost_context_callback_ = lost_context_callback; | 196 lost_context_callback_ = lost_context_callback; |
196 } | 197 } |
197 | 198 |
198 } // namespace content | 199 } // namespace content |
OLD | NEW |