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 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 void onContextLost() override { | 35 void onContextLost() override { |
36 provider_->OnLostContext(); | 36 provider_->OnLostContext(); |
37 } | 37 } |
38 | 38 |
39 private: | 39 private: |
40 ContextProviderInProcess* provider_; | 40 ContextProviderInProcess* provider_; |
41 }; | 41 }; |
42 | 42 |
43 // static | 43 // static |
44 scoped_refptr<ContextProviderInProcess> ContextProviderInProcess::Create( | 44 scoped_refptr<ContextProviderInProcess> ContextProviderInProcess::Create( |
45 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d, | 45 std::unique_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d, |
46 const std::string& debug_name) { | 46 const std::string& debug_name) { |
47 if (!context3d) | 47 if (!context3d) |
48 return nullptr; | 48 return nullptr; |
49 return new ContextProviderInProcess(std::move(context3d), debug_name); | 49 return new ContextProviderInProcess(std::move(context3d), debug_name); |
50 } | 50 } |
51 | 51 |
52 ContextProviderInProcess::ContextProviderInProcess( | 52 ContextProviderInProcess::ContextProviderInProcess( |
53 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d, | 53 std::unique_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d, |
54 const std::string& debug_name) | 54 const std::string& debug_name) |
55 : context3d_(std::move(context3d)), debug_name_(debug_name) { | 55 : context3d_(std::move(context3d)), debug_name_(debug_name) { |
56 DCHECK(main_thread_checker_.CalledOnValidThread()); | 56 DCHECK(main_thread_checker_.CalledOnValidThread()); |
57 DCHECK(context3d_); | 57 DCHECK(context3d_); |
58 context_thread_checker_.DetachFromThread(); | 58 context_thread_checker_.DetachFromThread(); |
59 } | 59 } |
60 | 60 |
61 ContextProviderInProcess::~ContextProviderInProcess() { | 61 ContextProviderInProcess::~ContextProviderInProcess() { |
62 DCHECK(main_thread_checker_.CalledOnValidThread() || | 62 DCHECK(main_thread_checker_.CalledOnValidThread() || |
63 context_thread_checker_.CalledOnValidThread()); | 63 context_thread_checker_.CalledOnValidThread()); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 void ContextProviderInProcess::SetLostContextCallback( | 178 void ContextProviderInProcess::SetLostContextCallback( |
179 const LostContextCallback& lost_context_callback) { | 179 const LostContextCallback& lost_context_callback) { |
180 DCHECK(context_thread_checker_.CalledOnValidThread()); | 180 DCHECK(context_thread_checker_.CalledOnValidThread()); |
181 DCHECK(lost_context_callback_.is_null() || | 181 DCHECK(lost_context_callback_.is_null() || |
182 lost_context_callback.is_null()); | 182 lost_context_callback.is_null()); |
183 lost_context_callback_ = lost_context_callback; | 183 lost_context_callback_ = lost_context_callback; |
184 } | 184 } |
185 | 185 |
186 } // namespace content | 186 } // namespace content |
OLD | NEW |