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

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

Issue 1414683003: Fix gpu command buffer use after free by GrContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test fixup Created 5 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
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 "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
11 #include "base/threading/thread_checker.h" 11 #include "base/threading/thread_checker.h"
12 #include "cc/blink/context_provider_web_context.h" 12 #include "cc/blink/context_provider_web_context.h"
13 #include "cc/output/context_provider.h" 13 #include "cc/output/context_provider.h"
14 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
15 #include "content/common/gpu/client/command_buffer_metrics.h" 15 #include "content/common/gpu/client/command_buffer_metrics.h"
16 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 16 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
17 #include "skia/ext/refptr.h"
17 18
18 namespace content { 19 namespace content {
19 20
20 class GrContextForWebGraphicsContext3D; 21 class GrContextForWebGraphicsContext3D;
22 class GrGLInterfaceForWebGraphicsContext3D;
21 23
22 // Implementation of cc::ContextProvider that provides a 24 // Implementation of cc::ContextProvider that provides a
23 // WebGraphicsContext3DCommandBufferImpl context and a GrContext. 25 // WebGraphicsContext3DCommandBufferImpl context and a GrContext.
24 class CONTENT_EXPORT ContextProviderCommandBuffer 26 class CONTENT_EXPORT ContextProviderCommandBuffer
25 : NON_EXPORTED_BASE(public cc_blink::ContextProviderWebContext) { 27 : NON_EXPORTED_BASE(public cc_blink::ContextProviderWebContext) {
26 public: 28 public:
27 static scoped_refptr<ContextProviderCommandBuffer> Create( 29 static scoped_refptr<ContextProviderCommandBuffer> Create(
28 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d, 30 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d,
29 CommandBufferContextType type); 31 CommandBufferContextType type);
30 32
(...skipping 18 matching lines...) Expand all
49 51
50 protected: 52 protected:
51 ContextProviderCommandBuffer( 53 ContextProviderCommandBuffer(
52 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d, 54 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d,
53 CommandBufferContextType type); 55 CommandBufferContextType type);
54 ~ContextProviderCommandBuffer() override; 56 ~ContextProviderCommandBuffer() override;
55 57
56 void OnLostContext(); 58 void OnLostContext();
57 59
58 private: 60 private:
61 WebGraphicsContext3DCommandBufferImpl* WebContext3DNoChecks();
59 void InitializeCapabilities(); 62 void InitializeCapabilities();
60 63
61 base::ThreadChecker main_thread_checker_; 64 base::ThreadChecker main_thread_checker_;
62 base::ThreadChecker context_thread_checker_; 65 base::ThreadChecker context_thread_checker_;
63 66
64 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d_; 67 skia::RefPtr<GrGLInterfaceForWebGraphicsContext3D> gr_interface_;
65 scoped_ptr<GrContextForWebGraphicsContext3D> gr_context_; 68 scoped_ptr<GrContextForWebGraphicsContext3D> gr_context_;
66 69
67 cc::ContextProvider::Capabilities capabilities_; 70 cc::ContextProvider::Capabilities capabilities_;
68 CommandBufferContextType context_type_; 71 CommandBufferContextType context_type_;
69 std::string debug_name_; 72 std::string debug_name_;
70 73
71 LostContextCallback lost_context_callback_; 74 LostContextCallback lost_context_callback_;
72 75
73 base::Lock context_lock_; 76 base::Lock context_lock_;
74 77
75 class LostContextCallbackProxy; 78 class LostContextCallbackProxy;
79 friend class LostContextCallbackProxy;
76 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; 80 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_;
77 }; 81 };
78 82
79 } // namespace content 83 } // namespace content
80 84
81 #endif // CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER_H_ 85 #endif // CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER_H_
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_ipc_browsertests.cc ('k') | content/common/gpu/client/context_provider_command_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698