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

Side by Side Diff: gpu/ipc/service/gpu_command_buffer_stub.h

Issue 2492583002: Decouple PassThroughImageTransportSurface from GpuCommandBufferStub (Closed)
Patch Set: Addressed Antoine's comments Created 4 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
« no previous file with comments | « gpu/ipc/service/BUILD.gn ('k') | gpu/ipc/service/gpu_command_buffer_stub.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 GPU_IPC_SERVICE_GPU_COMMAND_BUFFER_STUB_H_ 5 #ifndef GPU_IPC_SERVICE_GPU_COMMAND_BUFFER_STUB_H_
6 #define GPU_IPC_SERVICE_GPU_COMMAND_BUFFER_STUB_H_ 6 #define GPU_IPC_SERVICE_GPU_COMMAND_BUFFER_STUB_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <deque> 11 #include <deque>
12 #include <memory> 12 #include <memory>
13 #include <string> 13 #include <string>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "base/observer_list.h" 18 #include "base/observer_list.h"
19 #include "base/time/time.h" 19 #include "base/time/time.h"
20 #include "gpu/command_buffer/common/command_buffer_id.h" 20 #include "gpu/command_buffer/common/command_buffer_id.h"
21 #include "gpu/command_buffer/common/constants.h" 21 #include "gpu/command_buffer/common/constants.h"
22 #include "gpu/command_buffer/common/gpu_memory_allocation.h" 22 #include "gpu/command_buffer/common/gpu_memory_allocation.h"
23 #include "gpu/command_buffer/service/command_buffer_service.h" 23 #include "gpu/command_buffer/service/command_buffer_service.h"
24 #include "gpu/command_buffer/service/command_executor.h" 24 #include "gpu/command_buffer/service/command_executor.h"
25 #include "gpu/command_buffer/service/context_group.h" 25 #include "gpu/command_buffer/service/context_group.h"
26 #include "gpu/gpu_export.h" 26 #include "gpu/gpu_export.h"
27 #include "gpu/ipc/common/surface_handle.h" 27 #include "gpu/ipc/common/surface_handle.h"
28 #include "gpu/ipc/service/gpu_memory_manager.h" 28 #include "gpu/ipc/service/gpu_memory_manager.h"
29 #include "gpu/ipc/service/image_transport_surface_delegate.h"
29 #include "ipc/ipc_listener.h" 30 #include "ipc/ipc_listener.h"
30 #include "ipc/ipc_sender.h" 31 #include "ipc/ipc_sender.h"
31 #include "ui/events/latency_info.h" 32 #include "ui/events/latency_info.h"
32 #include "ui/gfx/geometry/size.h" 33 #include "ui/gfx/geometry/size.h"
33 #include "ui/gfx/gpu_memory_buffer.h" 34 #include "ui/gfx/gpu_memory_buffer.h"
34 #include "ui/gfx/swap_result.h" 35 #include "ui/gfx/swap_result.h"
35 #include "ui/gl/gl_surface.h" 36 #include "ui/gl/gl_surface.h"
36 #include "ui/gl/gpu_preference.h" 37 #include "ui/gl/gpu_preference.h"
37 #include "url/gurl.h" 38 #include "url/gurl.h"
38 39
(...skipping 13 matching lines...) Expand all
52 53
53 namespace gpu { 54 namespace gpu {
54 55
55 class GpuChannel; 56 class GpuChannel;
56 class GpuWatchdogThread; 57 class GpuWatchdogThread;
57 struct WaitForCommandState; 58 struct WaitForCommandState;
58 59
59 class GPU_EXPORT GpuCommandBufferStub 60 class GPU_EXPORT GpuCommandBufferStub
60 : public IPC::Listener, 61 : public IPC::Listener,
61 public IPC::Sender, 62 public IPC::Sender,
63 public ImageTransportSurfaceDelegate,
62 public base::SupportsWeakPtr<GpuCommandBufferStub> { 64 public base::SupportsWeakPtr<GpuCommandBufferStub> {
63 public: 65 public:
64 class DestructionObserver { 66 class DestructionObserver {
65 public: 67 public:
66 // Called in Destroy(), before the context/surface are released. 68 // Called in Destroy(), before the context/surface are released.
67 virtual void OnWillDestroyStub() = 0; 69 virtual void OnWillDestroyStub() = 0;
68 70
69 protected: 71 protected:
70 virtual ~DestructionObserver() {} 72 virtual ~DestructionObserver() {}
71 }; 73 };
72 74
73 typedef base::Callback<void(const std::vector<ui::LatencyInfo>&)> 75 typedef base::Callback<void(const std::vector<ui::LatencyInfo>&)>
74 LatencyInfoCallback; 76 LatencyInfoCallback;
75 77
76 static std::unique_ptr<GpuCommandBufferStub> Create( 78 static std::unique_ptr<GpuCommandBufferStub> Create(
77 GpuChannel* channel, 79 GpuChannel* channel,
78 GpuCommandBufferStub* share_group, 80 GpuCommandBufferStub* share_group,
79 const GPUCreateCommandBufferConfig& init_params, 81 const GPUCreateCommandBufferConfig& init_params,
80 int32_t route_id, 82 int32_t route_id,
81 std::unique_ptr<base::SharedMemory> shared_state_shm); 83 std::unique_ptr<base::SharedMemory> shared_state_shm);
82 84
83 ~GpuCommandBufferStub() override; 85 ~GpuCommandBufferStub() override;
84 86
85 // IPC::Listener implementation: 87 // IPC::Listener implementation:
86 bool OnMessageReceived(const IPC::Message& message) override; 88 bool OnMessageReceived(const IPC::Message& message) override;
87 89
88 // IPC::Sender implementation: 90 // IPC::Sender implementation:
89 bool Send(IPC::Message* msg) override; 91 bool Send(IPC::Message* msg) override;
90 92
93 // PassThroughImageTransportSuraceDelegate implementation:
94 void DidSwapBuffersComplete(SwapBuffersCompleteParams params) override;
95 const gles2::FeatureInfo* GetFeatureInfo() const override;
96 void SetLatencyInfoCallback(const LatencyInfoCallback& callback) override;
97 void UpdateVSyncParameters(base::TimeTicks timebase,
98 base::TimeDelta interval) override;
99
91 gles2::MemoryTracker* GetMemoryTracker() const; 100 gles2::MemoryTracker* GetMemoryTracker() const;
92 101
93 // Whether this command buffer can currently handle IPC messages. 102 // Whether this command buffer can currently handle IPC messages.
94 bool IsScheduled(); 103 bool IsScheduled();
95 104
96 // Whether there are commands in the buffer that haven't been processed. 105 // Whether there are commands in the buffer that haven't been processed.
97 bool HasUnprocessedCommands(); 106 bool HasUnprocessedCommands();
98 107
99 gles2::GLES2Decoder* decoder() const { return decoder_.get(); } 108 gles2::GLES2Decoder* decoder() const { return decoder_.get(); }
100 CommandExecutor* scheduler() const { return executor_.get(); } 109 CommandExecutor* scheduler() const { return executor_.get(); }
(...skipping 12 matching lines...) Expand all
113 // Sends a message to the console. 122 // Sends a message to the console.
114 void SendConsoleMessage(int32_t id, const std::string& message); 123 void SendConsoleMessage(int32_t id, const std::string& message);
115 124
116 void SendCachedShader(const std::string& key, const std::string& shader); 125 void SendCachedShader(const std::string& key, const std::string& shader);
117 126
118 gl::GLSurface* surface() const { return surface_.get(); } 127 gl::GLSurface* surface() const { return surface_.get(); }
119 128
120 void AddDestructionObserver(DestructionObserver* observer); 129 void AddDestructionObserver(DestructionObserver* observer);
121 void RemoveDestructionObserver(DestructionObserver* observer); 130 void RemoveDestructionObserver(DestructionObserver* observer);
122 131
123 void SetLatencyInfoCallback(const LatencyInfoCallback& callback);
124
125 void MarkContextLost(); 132 void MarkContextLost();
126 133
127 const gles2::FeatureInfo* GetFeatureInfo() const;
128
129 void SendSwapBuffersCompleted(
130 const GpuCommandBufferMsg_SwapBuffersCompleted_Params& params);
131 void SendUpdateVSyncParameters(base::TimeTicks timebase,
132 base::TimeDelta interval);
133
134 private: 134 private:
135 GpuCommandBufferStub(GpuChannel* channel, 135 GpuCommandBufferStub(GpuChannel* channel,
136 const GPUCreateCommandBufferConfig& init_params, 136 const GPUCreateCommandBufferConfig& init_params,
137 int32_t route_id); 137 int32_t route_id);
138 138
139 bool Initialize(GpuCommandBufferStub* share_group, 139 bool Initialize(GpuCommandBufferStub* share_group,
140 const GPUCreateCommandBufferConfig& init_params, 140 const GPUCreateCommandBufferConfig& init_params,
141 std::unique_ptr<base::SharedMemory> shared_state_shm); 141 std::unique_ptr<base::SharedMemory> shared_state_shm);
142 142
143 GpuMemoryManager* GetMemoryManager() const; 143 GpuMemoryManager* GetMemoryManager() const;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 250
251 std::unique_ptr<WaitForCommandState> wait_for_token_; 251 std::unique_ptr<WaitForCommandState> wait_for_token_;
252 std::unique_ptr<WaitForCommandState> wait_for_get_offset_; 252 std::unique_ptr<WaitForCommandState> wait_for_get_offset_;
253 253
254 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); 254 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub);
255 }; 255 };
256 256
257 } // namespace gpu 257 } // namespace gpu
258 258
259 #endif // GPU_IPC_SERVICE_GPU_COMMAND_BUFFER_STUB_H_ 259 #endif // GPU_IPC_SERVICE_GPU_COMMAND_BUFFER_STUB_H_
OLDNEW
« no previous file with comments | « gpu/ipc/service/BUILD.gn ('k') | gpu/ipc/service/gpu_command_buffer_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698