| 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 <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/strings/string_split.h" | 13 #include "base/strings/string_split.h" |
| 14 #include "cc/test/test_web_graphics_context_3d.h" | 14 #include "cc/test/test_web_graphics_context_3d.h" |
| 15 | 15 |
| 16 namespace cc { | 16 namespace cc { |
| 17 | 17 |
| 18 class TestContextProvider::LostContextCallbackProxy | 18 class TestContextProvider::LostContextCallbackProxy |
| 19 : public WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback { | 19 : public blink::WebGraphicsContext3D::WebGraphicsContextLostCallback { |
| 20 public: | 20 public: |
| 21 explicit LostContextCallbackProxy(TestContextProvider* provider) | 21 explicit LostContextCallbackProxy(TestContextProvider* provider) |
| 22 : provider_(provider) { | 22 : provider_(provider) { |
| 23 provider_->context3d_->setContextLostCallback(this); | 23 provider_->context3d_->setContextLostCallback(this); |
| 24 } | 24 } |
| 25 | 25 |
| 26 virtual ~LostContextCallbackProxy() { | 26 virtual ~LostContextCallbackProxy() { |
| 27 provider_->context3d_->setContextLostCallback(NULL); | 27 provider_->context3d_->setContextLostCallback(NULL); |
| 28 } | 28 } |
| 29 | 29 |
| 30 virtual void onContextLost() { | 30 virtual void onContextLost() { |
| 31 provider_->OnLostContext(); | 31 provider_->OnLostContext(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 private: | 34 private: |
| 35 TestContextProvider* provider_; | 35 TestContextProvider* provider_; |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 class TestContextProvider::SwapBuffersCompleteCallbackProxy | 38 class TestContextProvider::SwapBuffersCompleteCallbackProxy |
| 39 : public WebKit::WebGraphicsContext3D:: | 39 : public blink::WebGraphicsContext3D:: |
| 40 WebGraphicsSwapBuffersCompleteCallbackCHROMIUM { | 40 WebGraphicsSwapBuffersCompleteCallbackCHROMIUM { |
| 41 public: | 41 public: |
| 42 explicit SwapBuffersCompleteCallbackProxy(TestContextProvider* provider) | 42 explicit SwapBuffersCompleteCallbackProxy(TestContextProvider* provider) |
| 43 : provider_(provider) { | 43 : provider_(provider) { |
| 44 provider_->context3d_->setSwapBuffersCompleteCallbackCHROMIUM(this); | 44 provider_->context3d_->setSwapBuffersCompleteCallbackCHROMIUM(this); |
| 45 } | 45 } |
| 46 | 46 |
| 47 virtual ~SwapBuffersCompleteCallbackProxy() { | 47 virtual ~SwapBuffersCompleteCallbackProxy() { |
| 48 provider_->context3d_->setSwapBuffersCompleteCallbackCHROMIUM(NULL); | 48 provider_->context3d_->setSwapBuffersCompleteCallbackCHROMIUM(NULL); |
| 49 } | 49 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 109 } |
| 110 | 110 |
| 111 ContextProvider::Capabilities TestContextProvider::ContextCapabilities() { | 111 ContextProvider::Capabilities TestContextProvider::ContextCapabilities() { |
| 112 DCHECK(context3d_); | 112 DCHECK(context3d_); |
| 113 DCHECK(bound_); | 113 DCHECK(bound_); |
| 114 DCHECK(context_thread_checker_.CalledOnValidThread()); | 114 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 115 | 115 |
| 116 return context3d_->test_capabilities(); | 116 return context3d_->test_capabilities(); |
| 117 } | 117 } |
| 118 | 118 |
| 119 WebKit::WebGraphicsContext3D* TestContextProvider::Context3d() { | 119 blink::WebGraphicsContext3D* TestContextProvider::Context3d() { |
| 120 DCHECK(context3d_); | 120 DCHECK(context3d_); |
| 121 DCHECK(bound_); | 121 DCHECK(bound_); |
| 122 DCHECK(context_thread_checker_.CalledOnValidThread()); | 122 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 123 | 123 |
| 124 return context3d_.get(); | 124 return context3d_.get(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 gpu::ContextSupport* TestContextProvider::ContextSupport() { | 127 gpu::ContextSupport* TestContextProvider::ContextSupport() { |
| 128 DCHECK(context3d_); | 128 DCHECK(context3d_); |
| 129 DCHECK(bound_); | 129 DCHECK(bound_); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 DCHECK(memory_policy_changed_callback_.is_null() || cb.is_null()); | 226 DCHECK(memory_policy_changed_callback_.is_null() || cb.is_null()); |
| 227 memory_policy_changed_callback_ = cb; | 227 memory_policy_changed_callback_ = cb; |
| 228 } | 228 } |
| 229 | 229 |
| 230 void TestContextProvider::SetMaxTransferBufferUsageBytes( | 230 void TestContextProvider::SetMaxTransferBufferUsageBytes( |
| 231 size_t max_transfer_buffer_usage_bytes) { | 231 size_t max_transfer_buffer_usage_bytes) { |
| 232 context3d_->SetMaxTransferBufferUsageBytes(max_transfer_buffer_usage_bytes); | 232 context3d_->SetMaxTransferBufferUsageBytes(max_transfer_buffer_usage_bytes); |
| 233 } | 233 } |
| 234 | 234 |
| 235 } // namespace cc | 235 } // namespace cc |
| OLD | NEW |