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

Side by Side Diff: ppapi/proxy/ppapi_command_buffer_proxy.h

Issue 547733002: [Pepper GL] Use shared state to fix a memory leak in MapSub GL extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remve base/memory/shared_memory.h from DEPS Created 6 years, 3 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 | « ppapi/proxy/nacl_message_scanner.cc ('k') | ppapi/proxy/ppapi_command_buffer_proxy.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 PPAPI_PROXY_COMMAND_BUFFER_PROXY_H_ 5 #ifndef PPAPI_PROXY_COMMAND_BUFFER_PROXY_H_
6 #define PPAPI_PROXY_COMMAND_BUFFER_PROXY_H_ 6 #define PPAPI_PROXY_COMMAND_BUFFER_PROXY_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/memory/scoped_ptr.h"
10 #include "gpu/command_buffer/client/gpu_control.h" 11 #include "gpu/command_buffer/client/gpu_control.h"
11 #include "gpu/command_buffer/common/command_buffer.h" 12 #include "gpu/command_buffer/common/command_buffer.h"
13 #include "gpu/command_buffer/common/command_buffer_shared.h"
12 #include "ppapi/proxy/ppapi_proxy_export.h" 14 #include "ppapi/proxy/ppapi_proxy_export.h"
13 #include "ppapi/shared_impl/host_resource.h" 15 #include "ppapi/shared_impl/host_resource.h"
14 16
15 namespace IPC { 17 namespace IPC {
16 class Message; 18 class Message;
17 } 19 }
18 20
19 namespace ppapi { 21 namespace ppapi {
20 namespace proxy { 22 namespace proxy {
21 23
22 class ProxyChannel; 24 class ProxyChannel;
25 class SerializedHandle;
23 26
24 class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public gpu::CommandBuffer, 27 class PPAPI_PROXY_EXPORT PpapiCommandBufferProxy : public gpu::CommandBuffer,
25 public gpu::GpuControl { 28 public gpu::GpuControl {
26 public: 29 public:
27 PpapiCommandBufferProxy(const HostResource& resource, 30 PpapiCommandBufferProxy(const HostResource& resource,
28 ProxyChannel* channel); 31 ProxyChannel* channel,
32 const SerializedHandle& shared_state);
29 virtual ~PpapiCommandBufferProxy(); 33 virtual ~PpapiCommandBufferProxy();
30 34
31 // gpu::CommandBuffer implementation: 35 // gpu::CommandBuffer implementation:
32 virtual bool Initialize() OVERRIDE; 36 virtual bool Initialize() OVERRIDE;
33 virtual State GetLastState() OVERRIDE; 37 virtual State GetLastState() OVERRIDE;
34 virtual int32 GetLastToken() OVERRIDE; 38 virtual int32 GetLastToken() OVERRIDE;
35 virtual void Flush(int32 put_offset) OVERRIDE; 39 virtual void Flush(int32 put_offset) OVERRIDE;
36 virtual void WaitForTokenInRange(int32 start, int32 end) OVERRIDE; 40 virtual void WaitForTokenInRange(int32 start, int32 end) OVERRIDE;
37 virtual void WaitForGetOffsetInRange(int32 start, int32 end) OVERRIDE; 41 virtual void WaitForGetOffsetInRange(int32 start, int32 end) OVERRIDE;
38 virtual void SetGetBuffer(int32 transfer_buffer_id) OVERRIDE; 42 virtual void SetGetBuffer(int32 transfer_buffer_id) OVERRIDE;
(...skipping 17 matching lines...) Expand all
56 virtual void SignalQuery(uint32 query, 60 virtual void SignalQuery(uint32 query,
57 const base::Closure& callback) OVERRIDE; 61 const base::Closure& callback) OVERRIDE;
58 virtual void SetSurfaceVisible(bool visible) OVERRIDE; 62 virtual void SetSurfaceVisible(bool visible) OVERRIDE;
59 virtual void Echo(const base::Closure& callback) OVERRIDE; 63 virtual void Echo(const base::Closure& callback) OVERRIDE;
60 virtual uint32 CreateStreamTexture(uint32 texture_id) OVERRIDE; 64 virtual uint32 CreateStreamTexture(uint32 texture_id) OVERRIDE;
61 65
62 private: 66 private:
63 bool Send(IPC::Message* msg); 67 bool Send(IPC::Message* msg);
64 void UpdateState(const gpu::CommandBuffer::State& state, bool success); 68 void UpdateState(const gpu::CommandBuffer::State& state, bool success);
65 69
70 // Try to read an updated copy of the state from shared memory.
71 void TryUpdateState();
72
73 // The shared memory area used to update state.
74 gpu::CommandBufferSharedState* shared_state() const;
75
66 State last_state_; 76 State last_state_;
77 scoped_ptr<base::SharedMemory> shared_state_shm_;
67 78
68 HostResource resource_; 79 HostResource resource_;
69 ProxyChannel* channel_; 80 ProxyChannel* channel_;
70 81
71 base::Closure channel_error_callback_; 82 base::Closure channel_error_callback_;
72 83
73 DISALLOW_COPY_AND_ASSIGN(PpapiCommandBufferProxy); 84 DISALLOW_COPY_AND_ASSIGN(PpapiCommandBufferProxy);
74 }; 85 };
75 86
76 } // namespace proxy 87 } // namespace proxy
77 } // namespace ppapi 88 } // namespace ppapi
78 89
79 #endif // PPAPI_PROXY_COMMAND_BUFFER_PROXY_H_ 90 #endif // PPAPI_PROXY_COMMAND_BUFFER_PROXY_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/nacl_message_scanner.cc ('k') | ppapi/proxy/ppapi_command_buffer_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698