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 CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 5 #ifndef CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
6 #define CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 6 #define CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
16 #include "content/common/gpu/gpu_memory_manager.h" | 16 #include "content/common/gpu/gpu_memory_manager.h" |
17 #include "content/common/gpu/gpu_memory_manager_client.h" | |
18 #include "gpu/command_buffer/common/constants.h" | 17 #include "gpu/command_buffer/common/constants.h" |
19 #include "gpu/command_buffer/common/gpu_memory_allocation.h" | 18 #include "gpu/command_buffer/common/gpu_memory_allocation.h" |
20 #include "gpu/command_buffer/service/command_buffer_service.h" | 19 #include "gpu/command_buffer/service/command_buffer_service.h" |
21 #include "gpu/command_buffer/service/context_group.h" | 20 #include "gpu/command_buffer/service/context_group.h" |
22 #include "gpu/command_buffer/service/gpu_scheduler.h" | 21 #include "gpu/command_buffer/service/gpu_scheduler.h" |
23 #include "ipc/ipc_listener.h" | 22 #include "ipc/ipc_listener.h" |
24 #include "ipc/ipc_sender.h" | 23 #include "ipc/ipc_sender.h" |
25 #include "media/base/video_decoder_config.h" | 24 #include "media/base/video_decoder_config.h" |
26 #include "ui/events/latency_info.h" | 25 #include "ui/events/latency_info.h" |
27 #include "ui/gfx/geometry/size.h" | 26 #include "ui/gfx/geometry/size.h" |
(...skipping 20 matching lines...) Expand all Loading... |
48 | 47 |
49 namespace content { | 48 namespace content { |
50 | 49 |
51 class GpuChannel; | 50 class GpuChannel; |
52 class GpuVideoDecodeAccelerator; | 51 class GpuVideoDecodeAccelerator; |
53 class GpuVideoEncodeAccelerator; | 52 class GpuVideoEncodeAccelerator; |
54 class GpuWatchdog; | 53 class GpuWatchdog; |
55 struct WaitForCommandState; | 54 struct WaitForCommandState; |
56 | 55 |
57 class GpuCommandBufferStub | 56 class GpuCommandBufferStub |
58 : public GpuMemoryManagerClient, | 57 : public IPC::Listener, |
59 public IPC::Listener, | |
60 public IPC::Sender, | 58 public IPC::Sender, |
61 public base::SupportsWeakPtr<GpuCommandBufferStub> { | 59 public base::SupportsWeakPtr<GpuCommandBufferStub> { |
62 public: | 60 public: |
63 class DestructionObserver { | 61 class DestructionObserver { |
64 public: | 62 public: |
65 // Called in Destroy(), before the context/surface are released. | 63 // Called in Destroy(), before the context/surface are released. |
66 virtual void OnWillDestroyStub() = 0; | 64 virtual void OnWillDestroyStub() = 0; |
67 | 65 |
68 protected: | 66 protected: |
69 virtual ~DestructionObserver() {} | 67 virtual ~DestructionObserver() {} |
(...skipping 23 matching lines...) Expand all Loading... |
93 const GURL& active_url); | 91 const GURL& active_url); |
94 | 92 |
95 ~GpuCommandBufferStub() override; | 93 ~GpuCommandBufferStub() override; |
96 | 94 |
97 // IPC::Listener implementation: | 95 // IPC::Listener implementation: |
98 bool OnMessageReceived(const IPC::Message& message) override; | 96 bool OnMessageReceived(const IPC::Message& message) override; |
99 | 97 |
100 // IPC::Sender implementation: | 98 // IPC::Sender implementation: |
101 bool Send(IPC::Message* msg) override; | 99 bool Send(IPC::Message* msg) override; |
102 | 100 |
103 // GpuMemoryManagerClient implementation: | 101 gpu::gles2::MemoryTracker* GetMemoryTracker() const; |
104 gfx::Size GetSurfaceSize() const override; | |
105 gpu::gles2::MemoryTracker* GetMemoryTracker() const override; | |
106 void SuggestHaveFrontBuffer(bool suggest_have_frontbuffer) override; | |
107 bool GetTotalGpuMemory(uint64* bytes) override; | |
108 | 102 |
109 // Whether this command buffer can currently handle IPC messages. | 103 // Whether this command buffer can currently handle IPC messages. |
110 bool IsScheduled(); | 104 bool IsScheduled(); |
111 | 105 |
112 // Whether there are commands in the buffer that haven't been processed. | 106 // Whether there are commands in the buffer that haven't been processed. |
113 bool HasUnprocessedCommands(); | 107 bool HasUnprocessedCommands(); |
114 | 108 |
115 gpu::gles2::GLES2Decoder* decoder() const { return decoder_.get(); } | 109 gpu::gles2::GLES2Decoder* decoder() const { return decoder_.get(); } |
116 gpu::GpuScheduler* scheduler() const { return scheduler_.get(); } | 110 gpu::GpuScheduler* scheduler() const { return scheduler_.get(); } |
117 GpuChannel* channel() const { return channel_; } | 111 GpuChannel* channel() const { return channel_; } |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 uint32_t previous_processed_num_; | 286 uint32_t previous_processed_num_; |
293 base::TimeTicks last_idle_time_; | 287 base::TimeTicks last_idle_time_; |
294 | 288 |
295 scoped_refptr<gpu::PreemptionFlag> preemption_flag_; | 289 scoped_refptr<gpu::PreemptionFlag> preemption_flag_; |
296 | 290 |
297 LatencyInfoCallback latency_info_callback_; | 291 LatencyInfoCallback latency_info_callback_; |
298 | 292 |
299 GURL active_url_; | 293 GURL active_url_; |
300 size_t active_url_hash_; | 294 size_t active_url_hash_; |
301 | 295 |
302 size_t total_gpu_memory_; | |
303 scoped_ptr<WaitForCommandState> wait_for_token_; | 296 scoped_ptr<WaitForCommandState> wait_for_token_; |
304 scoped_ptr<WaitForCommandState> wait_for_get_offset_; | 297 scoped_ptr<WaitForCommandState> wait_for_get_offset_; |
305 | 298 |
306 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); | 299 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); |
307 }; | 300 }; |
308 | 301 |
309 } // namespace content | 302 } // namespace content |
310 | 303 |
311 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 304 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
OLD | NEW |