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 #ifndef CC_TEST_TEST_CONTEXT_PROVIDER_H_ | 5 #ifndef CC_TEST_TEST_CONTEXT_PROVIDER_H_ |
6 #define CC_TEST_TEST_CONTEXT_PROVIDER_H_ | 6 #define CC_TEST_TEST_CONTEXT_PROVIDER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
12 #include "base/threading/thread_checker.h" | 12 #include "base/threading/thread_checker.h" |
13 #include "cc/output/context_provider.h" | 13 #include "cc/output/context_provider.h" |
14 #include "cc/test/test_context_support.h" | 14 #include "cc/test/test_context_support.h" |
| 15 #include "cc/test/test_gles2_interface.h" |
15 #include "gpu/command_buffer/client/gles2_interface_stub.h" | 16 #include "gpu/command_buffer/client/gles2_interface_stub.h" |
| 17 #include "ui/gfx/rect.h" |
16 | 18 |
17 namespace cc { | 19 namespace cc { |
18 class TestWebGraphicsContext3D; | 20 class TestWebGraphicsContext3D; |
19 class TestGLES2Interface; | |
20 | 21 |
21 class TestContextProvider : public ContextProvider { | 22 class TestContextProvider : public ContextProvider { |
22 public: | 23 public: |
23 typedef base::Callback<scoped_ptr<TestWebGraphicsContext3D>(void)> | 24 typedef base::Callback<scoped_ptr<TestWebGraphicsContext3D>(void)> |
24 CreateCallback; | 25 CreateCallback; |
25 | 26 |
26 static scoped_refptr<TestContextProvider> Create(); | 27 static scoped_refptr<TestContextProvider> Create(); |
27 static scoped_refptr<TestContextProvider> Create( | 28 static scoped_refptr<TestContextProvider> Create( |
28 scoped_ptr<TestWebGraphicsContext3D> context); | 29 scoped_ptr<TestWebGraphicsContext3D> context); |
29 | 30 |
(...skipping 17 matching lines...) Expand all Loading... |
47 // state on the test context before binding. Don't call | 48 // state on the test context before binding. Don't call |
48 // InitializeOnCurrentThread on the context returned from this method. | 49 // InitializeOnCurrentThread on the context returned from this method. |
49 TestWebGraphicsContext3D* UnboundTestContext3d(); | 50 TestWebGraphicsContext3D* UnboundTestContext3d(); |
50 | 51 |
51 TestContextSupport* support() { return &support_; } | 52 TestContextSupport* support() { return &support_; } |
52 | 53 |
53 void SetMemoryAllocation(const ManagedMemoryPolicy& policy); | 54 void SetMemoryAllocation(const ManagedMemoryPolicy& policy); |
54 | 55 |
55 void SetMaxTransferBufferUsageBytes(size_t max_transfer_buffer_usage_bytes); | 56 void SetMaxTransferBufferUsageBytes(size_t max_transfer_buffer_usage_bytes); |
56 | 57 |
| 58 TestGLES2Interface::SwapType last_swap_type() const { |
| 59 return context_gl_->last_swap_type(); |
| 60 } |
| 61 gfx::Rect last_partial_swap_rect() const { |
| 62 return context_gl_->last_partial_swap_rect(); |
| 63 } |
| 64 |
57 protected: | 65 protected: |
58 explicit TestContextProvider(scoped_ptr<TestWebGraphicsContext3D> context); | 66 explicit TestContextProvider(scoped_ptr<TestWebGraphicsContext3D> context); |
59 virtual ~TestContextProvider(); | 67 virtual ~TestContextProvider(); |
60 | 68 |
61 private: | 69 private: |
62 void OnLostContext(); | 70 void OnLostContext(); |
63 | 71 |
64 TestContextSupport support_; | 72 TestContextSupport support_; |
65 | 73 |
66 scoped_ptr<TestWebGraphicsContext3D> context3d_; | 74 scoped_ptr<TestWebGraphicsContext3D> context3d_; |
(...skipping 11 matching lines...) Expand all Loading... |
78 | 86 |
79 base::WeakPtrFactory<TestContextProvider> weak_ptr_factory_; | 87 base::WeakPtrFactory<TestContextProvider> weak_ptr_factory_; |
80 | 88 |
81 DISALLOW_COPY_AND_ASSIGN(TestContextProvider); | 89 DISALLOW_COPY_AND_ASSIGN(TestContextProvider); |
82 }; | 90 }; |
83 | 91 |
84 } // namespace cc | 92 } // namespace cc |
85 | 93 |
86 #endif // CC_TEST_TEST_CONTEXT_PROVIDER_H_ | 94 #endif // CC_TEST_TEST_CONTEXT_PROVIDER_H_ |
87 | 95 |
OLD | NEW |