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

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

Issue 1324413003: Move gpu memory calculations to Compositor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comment + android_arm64_dbg_recipe bot issue. Created 5 years, 2 months 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
« no previous file with comments | « cc/raster/tile_task_worker_pool_perftest.cc ('k') | cc/test/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
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"
(...skipping 26 matching lines...) Expand all
37 gpu::gles2::GLES2Interface* ContextGL() override; 37 gpu::gles2::GLES2Interface* ContextGL() override;
38 gpu::ContextSupport* ContextSupport() override; 38 gpu::ContextSupport* ContextSupport() override;
39 class GrContext* GrContext() override; 39 class GrContext* GrContext() override;
40 void InvalidateGrContext(uint32_t state) override; 40 void InvalidateGrContext(uint32_t state) override;
41 void SetupLock() override; 41 void SetupLock() override;
42 base::Lock* GetLock() override; 42 base::Lock* GetLock() override;
43 void VerifyContexts() override; 43 void VerifyContexts() override;
44 void DeleteCachedResources() override; 44 void DeleteCachedResources() override;
45 bool DestroyedOnMainThread() override; 45 bool DestroyedOnMainThread() override;
46 void SetLostContextCallback(const LostContextCallback& cb) override; 46 void SetLostContextCallback(const LostContextCallback& cb) override;
47 void SetMemoryPolicyChangedCallback(
48 const MemoryPolicyChangedCallback& cb) override;
49 47
50 TestWebGraphicsContext3D* TestContext3d(); 48 TestWebGraphicsContext3D* TestContext3d();
51 49
52 // This returns the TestWebGraphicsContext3D but is valid to call 50 // This returns the TestWebGraphicsContext3D but is valid to call
53 // before the context is bound to a thread. This is needed to set up 51 // before the context is bound to a thread. This is needed to set up
54 // state on the test context before binding. Don't call 52 // state on the test context before binding. Don't call
55 // InitializeOnCurrentThread on the context returned from this method. 53 // InitializeOnCurrentThread on the context returned from this method.
56 TestWebGraphicsContext3D* UnboundTestContext3d(); 54 TestWebGraphicsContext3D* UnboundTestContext3d();
57 55
58 TestContextSupport* support() { return &support_; } 56 TestContextSupport* support() { return &support_; }
59 57
60 void SetMemoryAllocation(const ManagedMemoryPolicy& policy);
61
62 void SetMaxTransferBufferUsageBytes(size_t max_transfer_buffer_usage_bytes); 58 void SetMaxTransferBufferUsageBytes(size_t max_transfer_buffer_usage_bytes);
63 59
64 protected: 60 protected:
65 explicit TestContextProvider(scoped_ptr<TestWebGraphicsContext3D> context); 61 explicit TestContextProvider(scoped_ptr<TestWebGraphicsContext3D> context);
66 ~TestContextProvider() override; 62 ~TestContextProvider() override;
67 63
68 private: 64 private:
69 void OnLostContext(); 65 void OnLostContext();
70 66
71 TestContextSupport support_; 67 TestContextSupport support_;
72 68
73 scoped_ptr<TestWebGraphicsContext3D> context3d_; 69 scoped_ptr<TestWebGraphicsContext3D> context3d_;
74 scoped_ptr<TestGLES2Interface> context_gl_; 70 scoped_ptr<TestGLES2Interface> context_gl_;
75 bool bound_; 71 bool bound_;
76 72
77 base::ThreadChecker main_thread_checker_; 73 base::ThreadChecker main_thread_checker_;
78 base::ThreadChecker context_thread_checker_; 74 base::ThreadChecker context_thread_checker_;
79 75
80 base::Lock destroyed_lock_; 76 base::Lock destroyed_lock_;
81 bool destroyed_; 77 bool destroyed_;
82 78
83 base::Lock context_lock_; 79 base::Lock context_lock_;
84 80
85 LostContextCallback lost_context_callback_; 81 LostContextCallback lost_context_callback_;
86 MemoryPolicyChangedCallback memory_policy_changed_callback_;
87 skia::RefPtr<class GrContext> gr_context_; 82 skia::RefPtr<class GrContext> gr_context_;
88 83
89 base::WeakPtrFactory<TestContextProvider> weak_ptr_factory_; 84 base::WeakPtrFactory<TestContextProvider> weak_ptr_factory_;
90 85
91 DISALLOW_COPY_AND_ASSIGN(TestContextProvider); 86 DISALLOW_COPY_AND_ASSIGN(TestContextProvider);
92 }; 87 };
93 88
94 } // namespace cc 89 } // namespace cc
95 90
96 #endif // CC_TEST_TEST_CONTEXT_PROVIDER_H_ 91 #endif // CC_TEST_TEST_CONTEXT_PROVIDER_H_
97 92
OLDNEW
« no previous file with comments | « cc/raster/tile_task_worker_pool_perftest.cc ('k') | cc/test/test_context_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698