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

Side by Side Diff: content/common/gpu/client/context_provider_command_buffer.h

Issue 1900993002: Move SharedMemoryLimits out of WebGraphicsContext3DCommandBufferImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@limits
Patch Set: move-limits: . Created 4 years, 8 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER_H_ 5 #ifndef CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER_H_
6 #define CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER_H_ 6 #define CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/synchronization/lock.h" 13 #include "base/synchronization/lock.h"
14 #include "base/threading/thread_checker.h" 14 #include "base/threading/thread_checker.h"
15 #include "cc/blink/context_provider_web_context.h" 15 #include "cc/blink/context_provider_web_context.h"
16 #include "cc/output/context_provider.h" 16 #include "cc/output/context_provider.h"
17 #include "content/common/content_export.h" 17 #include "content/common/content_export.h"
18 #include "content/common/gpu/client/command_buffer_metrics.h" 18 #include "content/common/gpu/client/command_buffer_metrics.h"
19 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 19 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
20 #include "gpu/command_buffer/client/shared_memory_limits.h"
20 21
21 namespace skia_bindings { 22 namespace skia_bindings {
22 class GrContextForGLES2Interface; 23 class GrContextForGLES2Interface;
23 } // namespace skia_bindings 24 } // namespace skia_bindings
24 25
25 namespace content { 26 namespace content {
26 27
27 // Implementation of cc::ContextProvider that provides a 28 // Implementation of cc::ContextProvider that provides a
28 // WebGraphicsContext3DCommandBufferImpl context and a GrContext. 29 // WebGraphicsContext3DCommandBufferImpl context and a GrContext.
29 class CONTENT_EXPORT ContextProviderCommandBuffer 30 class CONTENT_EXPORT ContextProviderCommandBuffer
30 : NON_EXPORTED_BASE(public cc_blink::ContextProviderWebContext) { 31 : NON_EXPORTED_BASE(public cc_blink::ContextProviderWebContext) {
31 public: 32 public:
32 ContextProviderCommandBuffer( 33 ContextProviderCommandBuffer(
33 std::unique_ptr<WebGraphicsContext3DCommandBufferImpl> context3d, 34 std::unique_ptr<WebGraphicsContext3DCommandBufferImpl> context3d,
35 const gpu::SharedMemoryLimits& memory_limits,
34 CommandBufferContextType type); 36 CommandBufferContextType type);
35 37
36 gpu::CommandBufferProxyImpl* GetCommandBufferProxy(); 38 gpu::CommandBufferProxyImpl* GetCommandBufferProxy();
37 39
38 // cc_blink::ContextProviderWebContext implementation. 40 // cc_blink::ContextProviderWebContext implementation.
39 WebGraphicsContext3DCommandBufferImpl* WebContext3D() override; 41 WebGraphicsContext3DCommandBufferImpl* WebContext3D() override;
40 42
41 // cc::ContextProvider implementation. 43 // cc::ContextProvider implementation.
42 bool BindToCurrentThread() override; 44 bool BindToCurrentThread() override;
43 void DetachFromThread() override; 45 void DetachFromThread() override;
44 gpu::gles2::GLES2Interface* ContextGL() override; 46 gpu::gles2::GLES2Interface* ContextGL() override;
45 gpu::ContextSupport* ContextSupport() override; 47 gpu::ContextSupport* ContextSupport() override;
46 class GrContext* GrContext() override; 48 class GrContext* GrContext() override;
47 void InvalidateGrContext(uint32_t state) override; 49 void InvalidateGrContext(uint32_t state) override;
48 void SetupLock() override; 50 void SetupLock() override;
49 base::Lock* GetLock() override; 51 base::Lock* GetLock() override;
50 Capabilities ContextCapabilities() override; 52 gpu::Capabilities ContextCapabilities() override;
51 void DeleteCachedResources() override; 53 void DeleteCachedResources() override;
52 void SetLostContextCallback( 54 void SetLostContextCallback(
53 const LostContextCallback& lost_context_callback) override; 55 const LostContextCallback& lost_context_callback) override;
54 56
55 protected: 57 protected:
56 ~ContextProviderCommandBuffer() override; 58 ~ContextProviderCommandBuffer() override;
57 59
58 void OnLostContext(); 60 void OnLostContext();
59 61
60 private: 62 private:
61 void InitializeCapabilities();
62
63 base::ThreadChecker main_thread_checker_; 63 base::ThreadChecker main_thread_checker_;
64 base::ThreadChecker context_thread_checker_; 64 base::ThreadChecker context_thread_checker_;
65 65
66 std::unique_ptr<WebGraphicsContext3DCommandBufferImpl> context3d_; 66 std::unique_ptr<WebGraphicsContext3DCommandBufferImpl> context3d_;
67 std::unique_ptr<skia_bindings::GrContextForGLES2Interface> gr_context_; 67 std::unique_ptr<skia_bindings::GrContextForGLES2Interface> gr_context_;
68 68
69 cc::ContextProvider::Capabilities capabilities_; 69 gpu::SharedMemoryLimits memory_limits_;
danakj 2016/04/19 01:57:16 We could in theory pass this to BindToCurrentThrea
70 CommandBufferContextType context_type_; 70 CommandBufferContextType context_type_;
71 std::string debug_name_; 71 std::string debug_name_;
72 72
73 LostContextCallback lost_context_callback_; 73 LostContextCallback lost_context_callback_;
74 74
75 base::Lock context_lock_; 75 base::Lock context_lock_;
76 76
77 class LostContextCallbackProxy; 77 class LostContextCallbackProxy;
78 std::unique_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; 78 std::unique_ptr<LostContextCallbackProxy> lost_context_callback_proxy_;
79 }; 79 };
80 80
81 } // namespace content 81 } // namespace content
82 82
83 #endif // CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER_H_ 83 #endif // CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698