Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/command_buffer/service/progress_reporter.h" | |
| 26 #include "gpu/gpu_export.h" | 27 #include "gpu/gpu_export.h" |
| 27 #include "gpu/ipc/common/surface_handle.h" | 28 #include "gpu/ipc/common/surface_handle.h" |
| 28 #include "gpu/ipc/service/gpu_memory_manager.h" | 29 #include "gpu/ipc/service/gpu_memory_manager.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" |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 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 gles2::ProgressReporter, | |
| 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 // ProgressReporter implementation | |
|
danakj
2016/10/05 21:36:15
period, or.. colon based on similar comments here.
ericrk
2016/10/05 22:36:17
Done.
| |
| 94 void ReportProgress() override; | |
| 95 | |
| 91 gles2::MemoryTracker* GetMemoryTracker() const; | 96 gles2::MemoryTracker* GetMemoryTracker() const; |
| 92 | 97 |
| 93 // Whether this command buffer can currently handle IPC messages. | 98 // Whether this command buffer can currently handle IPC messages. |
| 94 bool IsScheduled(); | 99 bool IsScheduled(); |
| 95 | 100 |
| 96 // Whether there are commands in the buffer that haven't been processed. | 101 // Whether there are commands in the buffer that haven't been processed. |
| 97 bool HasUnprocessedCommands(); | 102 bool HasUnprocessedCommands(); |
| 98 | 103 |
| 99 gles2::GLES2Decoder* decoder() const { return decoder_.get(); } | 104 gles2::GLES2Decoder* decoder() const { return decoder_.get(); } |
| 100 CommandExecutor* scheduler() const { return executor_.get(); } | 105 CommandExecutor* scheduler() const { return executor_.get(); } |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 | 255 |
| 251 std::unique_ptr<WaitForCommandState> wait_for_token_; | 256 std::unique_ptr<WaitForCommandState> wait_for_token_; |
| 252 std::unique_ptr<WaitForCommandState> wait_for_get_offset_; | 257 std::unique_ptr<WaitForCommandState> wait_for_get_offset_; |
| 253 | 258 |
| 254 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); | 259 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); |
| 255 }; | 260 }; |
| 256 | 261 |
| 257 } // namespace gpu | 262 } // namespace gpu |
| 258 | 263 |
| 259 #endif // GPU_IPC_SERVICE_GPU_COMMAND_BUFFER_STUB_H_ | 264 #endif // GPU_IPC_SERVICE_GPU_COMMAND_BUFFER_STUB_H_ |
| OLD | NEW |