| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/test/test_context_provider.h" | 5 #include "cc/test/test_context_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 return nullptr; | 33 return nullptr; |
| 34 // Worker contexts are bound to the thread they are created on. | 34 // Worker contexts are bound to the thread they are created on. |
| 35 if (!worker_context_provider->BindToCurrentThread()) | 35 if (!worker_context_provider->BindToCurrentThread()) |
| 36 return nullptr; | 36 return nullptr; |
| 37 worker_context_provider->SetupLock(); | 37 worker_context_provider->SetupLock(); |
| 38 return worker_context_provider; | 38 return worker_context_provider; |
| 39 } | 39 } |
| 40 | 40 |
| 41 // static | 41 // static |
| 42 scoped_refptr<TestContextProvider> TestContextProvider::Create( | 42 scoped_refptr<TestContextProvider> TestContextProvider::Create( |
| 43 scoped_ptr<TestWebGraphicsContext3D> context) { | 43 std::unique_ptr<TestWebGraphicsContext3D> context) { |
| 44 if (!context) | 44 if (!context) |
| 45 return NULL; | 45 return NULL; |
| 46 return new TestContextProvider(std::move(context)); | 46 return new TestContextProvider(std::move(context)); |
| 47 } | 47 } |
| 48 | 48 |
| 49 TestContextProvider::TestContextProvider( | 49 TestContextProvider::TestContextProvider( |
| 50 scoped_ptr<TestWebGraphicsContext3D> context) | 50 std::unique_ptr<TestWebGraphicsContext3D> context) |
| 51 : context3d_(std::move(context)), | 51 : context3d_(std::move(context)), |
| 52 context_gl_(new TestGLES2Interface(context3d_.get())), | 52 context_gl_(new TestGLES2Interface(context3d_.get())), |
| 53 bound_(false), | 53 bound_(false), |
| 54 weak_ptr_factory_(this) { | 54 weak_ptr_factory_(this) { |
| 55 DCHECK(main_thread_checker_.CalledOnValidThread()); | 55 DCHECK(main_thread_checker_.CalledOnValidThread()); |
| 56 DCHECK(context3d_); | 56 DCHECK(context3d_); |
| 57 context_thread_checker_.DetachFromThread(); | 57 context_thread_checker_.DetachFromThread(); |
| 58 context3d_->set_test_support(&support_); | 58 context3d_->set_test_support(&support_); |
| 59 } | 59 } |
| 60 | 60 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 DCHECK(lost_context_callback_.is_null() || cb.is_null()); | 168 DCHECK(lost_context_callback_.is_null() || cb.is_null()); |
| 169 lost_context_callback_ = cb; | 169 lost_context_callback_ = cb; |
| 170 } | 170 } |
| 171 | 171 |
| 172 void TestContextProvider::SetMaxTransferBufferUsageBytes( | 172 void TestContextProvider::SetMaxTransferBufferUsageBytes( |
| 173 size_t max_transfer_buffer_usage_bytes) { | 173 size_t max_transfer_buffer_usage_bytes) { |
| 174 context3d_->SetMaxTransferBufferUsageBytes(max_transfer_buffer_usage_bytes); | 174 context3d_->SetMaxTransferBufferUsageBytes(max_transfer_buffer_usage_bytes); |
| 175 } | 175 } |
| 176 | 176 |
| 177 } // namespace cc | 177 } // namespace cc |
| OLD | NEW |