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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/id_map.h" | 13 #include "base/id_map.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
17 #include "content/common/gpu/gpu_memory_allocation.h" | 17 #include "content/common/gpu/gpu_memory_allocation.h" |
18 #include "content/common/gpu/gpu_memory_allocation.h" | 18 #include "content/common/gpu/gpu_memory_allocation.h" |
19 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" | 19 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" |
20 #include "gpu/command_buffer/common/constants.h" | 20 #include "gpu/command_buffer/common/constants.h" |
21 #include "gpu/command_buffer/service/command_buffer_service.h" | 21 #include "gpu/command_buffer/service/command_buffer_service.h" |
22 #include "gpu/command_buffer/service/context_group.h" | 22 #include "gpu/command_buffer/service/context_group.h" |
23 #include "gpu/command_buffer/service/gpu_scheduler.h" | 23 #include "gpu/command_buffer/service/gpu_scheduler.h" |
24 #include "ipc/ipc_channel.h" | 24 #include "ipc/ipc_listener.h" |
25 #include "ipc/ipc_message.h" | 25 #include "ipc/ipc_sender.h" |
26 #include "ui/gfx/native_widget_types.h" | 26 #include "ui/gfx/native_widget_types.h" |
27 #include "ui/gfx/size.h" | 27 #include "ui/gfx/size.h" |
28 #include "ui/gl/gl_context.h" | 28 #include "ui/gl/gl_context.h" |
29 #include "ui/gl/gl_surface.h" | 29 #include "ui/gl/gl_surface.h" |
30 #include "ui/gl/gpu_preference.h" | 30 #include "ui/gl/gpu_preference.h" |
31 #include "ui/surface/transport_dib.h" | 31 #include "ui/surface/transport_dib.h" |
32 | 32 |
33 #if defined(OS_MACOSX) | 33 #if defined(OS_MACOSX) |
34 #include "ui/surface/accelerated_surface_mac.h" | 34 #include "ui/surface/accelerated_surface_mac.h" |
35 #endif | 35 #endif |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 virtual bool IsInSameContextShareGroup( | 71 virtual bool IsInSameContextShareGroup( |
72 const GpuCommandBufferStubBase& other) const = 0; | 72 const GpuCommandBufferStubBase& other) const = 0; |
73 | 73 |
74 virtual void SetMemoryAllocation( | 74 virtual void SetMemoryAllocation( |
75 const GpuMemoryAllocation& allocation) = 0; | 75 const GpuMemoryAllocation& allocation) = 0; |
76 }; | 76 }; |
77 | 77 |
78 class GpuCommandBufferStub | 78 class GpuCommandBufferStub |
79 : public GpuCommandBufferStubBase, | 79 : public GpuCommandBufferStubBase, |
80 public IPC::Channel::Listener, | 80 public IPC::Listener, |
81 public IPC::Message::Sender, | 81 public IPC::Sender, |
82 public base::SupportsWeakPtr<GpuCommandBufferStub> { | 82 public base::SupportsWeakPtr<GpuCommandBufferStub> { |
83 public: | 83 public: |
84 class DestructionObserver { | 84 class DestructionObserver { |
85 public: | 85 public: |
86 ~DestructionObserver() {} | 86 ~DestructionObserver() {} |
87 | 87 |
88 // Called in Destroy(), before the context/surface are released. | 88 // Called in Destroy(), before the context/surface are released. |
89 virtual void OnWillDestroyStub(GpuCommandBufferStub* stub) = 0; | 89 virtual void OnWillDestroyStub(GpuCommandBufferStub* stub) = 0; |
90 }; | 90 }; |
91 | 91 |
92 GpuCommandBufferStub( | 92 GpuCommandBufferStub( |
93 GpuChannel* channel, | 93 GpuChannel* channel, |
94 GpuCommandBufferStub* share_group, | 94 GpuCommandBufferStub* share_group, |
95 const gfx::GLSurfaceHandle& handle, | 95 const gfx::GLSurfaceHandle& handle, |
96 gpu::gles2::MailboxManager* mailbox_manager, | 96 gpu::gles2::MailboxManager* mailbox_manager, |
97 const gfx::Size& size, | 97 const gfx::Size& size, |
98 const gpu::gles2::DisallowedFeatures& disallowed_features, | 98 const gpu::gles2::DisallowedFeatures& disallowed_features, |
99 const std::string& allowed_extensions, | 99 const std::string& allowed_extensions, |
100 const std::vector<int32>& attribs, | 100 const std::vector<int32>& attribs, |
101 gfx::GpuPreference gpu_preference, | 101 gfx::GpuPreference gpu_preference, |
102 int32 route_id, | 102 int32 route_id, |
103 int32 surface_id, | 103 int32 surface_id, |
104 GpuWatchdog* watchdog, | 104 GpuWatchdog* watchdog, |
105 bool software); | 105 bool software); |
106 | 106 |
107 virtual ~GpuCommandBufferStub(); | 107 virtual ~GpuCommandBufferStub(); |
108 | 108 |
109 // IPC::Channel::Listener implementation: | 109 // IPC::Listener implementation: |
110 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 110 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
111 | 111 |
112 // IPC::Message::Sender implementation: | 112 // IPC::Sender implementation: |
113 virtual bool Send(IPC::Message* msg) OVERRIDE; | 113 virtual bool Send(IPC::Message* msg) OVERRIDE; |
114 | 114 |
115 // GpuCommandBufferStubBase implementation: | 115 // GpuCommandBufferStubBase implementation: |
116 virtual bool client_has_memory_allocation_changed_callback() const OVERRIDE; | 116 virtual bool client_has_memory_allocation_changed_callback() const OVERRIDE; |
117 virtual bool has_surface_state() const OVERRIDE; | 117 virtual bool has_surface_state() const OVERRIDE; |
118 virtual const GpuCommandBufferStubBase::SurfaceState& surface_state() const | 118 virtual const GpuCommandBufferStubBase::SurfaceState& surface_state() const |
119 OVERRIDE; | 119 OVERRIDE; |
120 | 120 |
121 // Returns surface size. | 121 // Returns surface size. |
122 virtual gfx::Size GetSurfaceSize() const OVERRIDE; | 122 virtual gfx::Size GetSurfaceSize() const OVERRIDE; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 // A queue of sync points associated with this stub. | 271 // A queue of sync points associated with this stub. |
272 std::deque<uint32> sync_points_; | 272 std::deque<uint32> sync_points_; |
273 int sync_point_wait_count_; | 273 int sync_point_wait_count_; |
274 | 274 |
275 scoped_refptr<gpu::RefCountedCounter> preempt_by_counter_; | 275 scoped_refptr<gpu::RefCountedCounter> preempt_by_counter_; |
276 | 276 |
277 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); | 277 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); |
278 }; | 278 }; |
279 | 279 |
280 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 280 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
OLD | NEW |