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

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

Issue 896723008: Add OrderingBarrierCHROMIUM API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed nits. Created 5 years, 10 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) 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 CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/atomic_sequence_num.h" 11 #include "base/atomic_sequence_num.h"
12 #include "base/containers/hash_tables.h" 12 #include "base/containers/hash_tables.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/process/process.h" 16 #include "base/process/process.h"
17 #include "base/synchronization/lock.h" 17 #include "base/synchronization/lock.h"
18 #include "content/common/content_export.h" 18 #include "content/common/content_export.h"
19 #include "content/common/gpu/gpu_process_launch_causes.h" 19 #include "content/common/gpu/gpu_process_launch_causes.h"
20 #include "content/common/gpu/gpu_result_codes.h" 20 #include "content/common/gpu/gpu_result_codes.h"
21 #include "content/common/message_router.h" 21 #include "content/common/message_router.h"
22 #include "gpu/config/gpu_info.h" 22 #include "gpu/config/gpu_info.h"
23 #include "ipc/ipc_channel_handle.h" 23 #include "ipc/ipc_channel_handle.h"
24 #include "ipc/ipc_sync_channel.h" 24 #include "ipc/ipc_sync_channel.h"
25 #include "ipc/message_filter.h" 25 #include "ipc/message_filter.h"
26 #include "ui/events/latency_info.h"
26 #include "ui/gfx/geometry/size.h" 27 #include "ui/gfx/geometry/size.h"
27 #include "ui/gfx/gpu_memory_buffer.h" 28 #include "ui/gfx/gpu_memory_buffer.h"
28 #include "ui/gfx/native_widget_types.h" 29 #include "ui/gfx/native_widget_types.h"
29 #include "ui/gl/gpu_preference.h" 30 #include "ui/gl/gpu_preference.h"
30 31
31 class GURL; 32 class GURL;
32 class TransportTextureService; 33 class TransportTextureService;
33 struct GPUCreateCommandBufferConfig; 34 struct GPUCreateCommandBufferConfig;
34 35
35 namespace base { 36 namespace base {
(...skipping 20 matching lines...) Expand all
56 class GpuChannelHost; 57 class GpuChannelHost;
57 58
58 struct GpuListenerInfo { 59 struct GpuListenerInfo {
59 GpuListenerInfo(); 60 GpuListenerInfo();
60 ~GpuListenerInfo(); 61 ~GpuListenerInfo();
61 62
62 base::WeakPtr<IPC::Listener> listener; 63 base::WeakPtr<IPC::Listener> listener;
63 scoped_refptr<base::MessageLoopProxy> loop; 64 scoped_refptr<base::MessageLoopProxy> loop;
64 }; 65 };
65 66
67 struct ProxyFlushInfo {
68 ProxyFlushInfo();
69 ~ProxyFlushInfo();
70
71 bool flush_pending;
72 int route_id;
73 int32 put_offset;
74 unsigned int flush_count;
75 std::vector<ui::LatencyInfo> latency_info;
76 };
77
66 class CONTENT_EXPORT GpuChannelHostFactory { 78 class CONTENT_EXPORT GpuChannelHostFactory {
67 public: 79 public:
68 virtual ~GpuChannelHostFactory() {} 80 virtual ~GpuChannelHostFactory() {}
69 81
70 virtual bool IsMainThread() = 0; 82 virtual bool IsMainThread() = 0;
71 virtual base::MessageLoop* GetMainLoop() = 0; 83 virtual base::MessageLoop* GetMainLoop() = 0;
72 virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() = 0; 84 virtual scoped_refptr<base::MessageLoopProxy> GetIOLoopProxy() = 0;
73 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory(size_t size) = 0; 85 virtual scoped_ptr<base::SharedMemory> AllocateSharedMemory(size_t size) = 0;
74 virtual CreateCommandBufferResult CreateViewCommandBuffer( 86 virtual CreateCommandBufferResult CreateViewCommandBuffer(
75 int32 surface_id, 87 int32 surface_id,
(...skipping 20 matching lines...) Expand all
96 DCHECK(channel_filter_.get()); 108 DCHECK(channel_filter_.get());
97 return channel_filter_->IsLost(); 109 return channel_filter_->IsLost();
98 } 110 }
99 111
100 // The GPU stats reported by the GPU process. 112 // The GPU stats reported by the GPU process.
101 const gpu::GPUInfo& gpu_info() const { return gpu_info_; } 113 const gpu::GPUInfo& gpu_info() const { return gpu_info_; }
102 114
103 // IPC::Sender implementation: 115 // IPC::Sender implementation:
104 bool Send(IPC::Message* msg) override; 116 bool Send(IPC::Message* msg) override;
105 117
118 // Set an ordering barrier. AsyncFlushes any pending barriers on other
119 // routes. Combines multiple OrderingBarriers into a single AsyncFlush.
120 void OrderingBarrier(int route_id,
121 int32 put_offset,
122 unsigned int flush_count,
123 const std::vector<ui::LatencyInfo>& latency_info,
124 bool put_offset_changed,
125 bool do_flush);
126
106 // Create and connect to a command buffer in the GPU process. 127 // Create and connect to a command buffer in the GPU process.
107 CommandBufferProxyImpl* CreateViewCommandBuffer( 128 CommandBufferProxyImpl* CreateViewCommandBuffer(
108 int32 surface_id, 129 int32 surface_id,
109 CommandBufferProxyImpl* share_group, 130 CommandBufferProxyImpl* share_group,
110 const std::vector<int32>& attribs, 131 const std::vector<int32>& attribs,
111 const GURL& active_url, 132 const GURL& active_url,
112 gfx::GpuPreference gpu_preference); 133 gfx::GpuPreference gpu_preference);
113 134
114 // Create and connect to a command buffer in the GPU process. 135 // Create and connect to a command buffer in the GPU process.
115 CommandBufferProxyImpl* CreateOffscreenCommandBuffer( 136 CommandBufferProxyImpl* CreateOffscreenCommandBuffer(
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 int32 GenerateRouteID(); 187 int32 GenerateRouteID();
167 188
168 private: 189 private:
169 friend class base::RefCountedThreadSafe<GpuChannelHost>; 190 friend class base::RefCountedThreadSafe<GpuChannelHost>;
170 GpuChannelHost(GpuChannelHostFactory* factory, 191 GpuChannelHost(GpuChannelHostFactory* factory,
171 const gpu::GPUInfo& gpu_info, 192 const gpu::GPUInfo& gpu_info,
172 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager); 193 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager);
173 ~GpuChannelHost() override; 194 ~GpuChannelHost() override;
174 void Connect(const IPC::ChannelHandle& channel_handle, 195 void Connect(const IPC::ChannelHandle& channel_handle,
175 base::WaitableEvent* shutdown_event); 196 base::WaitableEvent* shutdown_event);
197 bool InternalSend(IPC::Message* msg);
198 void InternalFlush();
176 199
177 // A filter used internally to route incoming messages from the IO thread 200 // A filter used internally to route incoming messages from the IO thread
178 // to the correct message loop. It also maintains some shared state between 201 // to the correct message loop. It also maintains some shared state between
179 // all the contexts. 202 // all the contexts.
180 class MessageFilter : public IPC::MessageFilter { 203 class MessageFilter : public IPC::MessageFilter {
181 public: 204 public:
182 MessageFilter(); 205 MessageFilter();
183 206
184 // Called on the IO thread. 207 // Called on the IO thread.
185 void AddRoute(int route_id, 208 void AddRoute(int route_id,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 base::AtomicSequenceNumber next_image_id_; 261 base::AtomicSequenceNumber next_image_id_;
239 262
240 // Route IDs are allocated in sequence. 263 // Route IDs are allocated in sequence.
241 base::AtomicSequenceNumber next_route_id_; 264 base::AtomicSequenceNumber next_route_id_;
242 265
243 // Protects proxies_. 266 // Protects proxies_.
244 mutable base::Lock context_lock_; 267 mutable base::Lock context_lock_;
245 // Used to look up a proxy from its routing id. 268 // Used to look up a proxy from its routing id.
246 typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap; 269 typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap;
247 ProxyMap proxies_; 270 ProxyMap proxies_;
271 ProxyFlushInfo flush_info_;
248 272
249 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); 273 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost);
250 }; 274 };
251 275
252 } // namespace content 276 } // namespace content
253 277
254 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ 278 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_
OLDNEW
« no previous file with comments | « content/common/gpu/client/command_buffer_proxy_impl.cc ('k') | content/common/gpu/client/gpu_channel_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698