Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: cc/debug/test_context_provider.h

Issue 50303007: Move test-only stuff from cc/debug/ to cc/test (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fold cc_test_utils into cc_test_support to fix windows link Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/debug/ordered_texture_map.cc ('k') | cc/debug/test_context_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CC_DEBUG_TEST_CONTEXT_PROVIDER_H_
6 #define CC_DEBUG_TEST_CONTEXT_PROVIDER_H_
7
8 #include "base/callback.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/synchronization/lock.h"
11 #include "base/threading/thread_checker.h"
12 #include "cc/base/cc_export.h"
13 #include "cc/debug/test_context_support.h"
14 #include "cc/output/context_provider.h"
15
16 namespace WebKit { class WebGraphicsContext3D; }
17
18 namespace cc {
19 class TestWebGraphicsContext3D;
20
21 class CC_EXPORT TestContextProvider
22 : public NON_EXPORTED_BASE(cc::ContextProvider) {
23 public:
24 typedef base::Callback<scoped_ptr<TestWebGraphicsContext3D>(void)>
25 CreateCallback;
26
27 static scoped_refptr<TestContextProvider> Create();
28 static scoped_refptr<TestContextProvider> Create(
29 scoped_ptr<TestWebGraphicsContext3D> context);
30
31 virtual bool BindToCurrentThread() OVERRIDE;
32 virtual Capabilities ContextCapabilities() OVERRIDE;
33 virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE;
34 virtual gpu::ContextSupport* ContextSupport() OVERRIDE;
35 virtual class GrContext* GrContext() OVERRIDE;
36 virtual void VerifyContexts() OVERRIDE;
37 virtual bool DestroyedOnMainThread() OVERRIDE;
38 virtual void SetLostContextCallback(const LostContextCallback& cb) OVERRIDE;
39 virtual void SetSwapBuffersCompleteCallback(
40 const SwapBuffersCompleteCallback& cb) OVERRIDE;
41 virtual void SetMemoryPolicyChangedCallback(
42 const MemoryPolicyChangedCallback& cb) OVERRIDE;
43
44 TestWebGraphicsContext3D* TestContext3d();
45
46 // This returns the TestWebGraphicsContext3D but is valid to call
47 // before the context is bound to a thread. This is needed to set up
48 // state on the test context before binding. Don't call
49 // makeContextCurrent on the context returned from this method.
50 TestWebGraphicsContext3D* UnboundTestContext3d();
51
52 void SetMemoryAllocation(const ManagedMemoryPolicy& policy,
53 bool discard_backbuffer_when_not_visible);
54
55 void SetMaxTransferBufferUsageBytes(size_t max_transfer_buffer_usage_bytes);
56
57 protected:
58 TestContextProvider(scoped_ptr<TestWebGraphicsContext3D> context);
59 virtual ~TestContextProvider();
60
61 void OnLostContext();
62 void OnSwapBuffersComplete();
63
64 TestContextSupport support_;
65
66 scoped_ptr<TestWebGraphicsContext3D> context3d_;
67 bool bound_;
68
69 base::ThreadChecker main_thread_checker_;
70 base::ThreadChecker context_thread_checker_;
71
72 base::Lock destroyed_lock_;
73 bool destroyed_;
74
75 LostContextCallback lost_context_callback_;
76 SwapBuffersCompleteCallback swap_buffers_complete_callback_;
77 MemoryPolicyChangedCallback memory_policy_changed_callback_;
78
79 class LostContextCallbackProxy;
80 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_;
81
82 class SwapBuffersCompleteCallbackProxy;
83 scoped_ptr<SwapBuffersCompleteCallbackProxy>
84 swap_buffers_complete_callback_proxy_;
85 };
86
87 } // namespace cc
88
89 #endif // CC_DEBUG_TEST_CONTEXT_PROVIDER_H_
90
OLDNEW
« no previous file with comments | « cc/debug/ordered_texture_map.cc ('k') | cc/debug/test_context_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698