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 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 #if defined(ENABLE_GPU) | 9 #if defined(ENABLE_GPU) |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 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/gfx/surface/transport_dib.h" | 28 #include "ui/gfx/surface/transport_dib.h" |
| 29 | 29 |
| 30 #if defined(OS_MACOSX) | 30 #if defined(OS_MACOSX) |
| 31 #include "ui/gfx/surface/accelerated_surface_mac.h" | 31 #include "ui/gfx/surface/accelerated_surface_mac.h" |
| 32 #endif | 32 #endif |
| 33 | 33 |
| 34 class GpuChannel; | 34 class GpuChannel; |
| 35 class GpuWatchdog; | 35 class GpuWatchdog; |
| 36 class GpuMemoryAllocation; | |
| 36 | 37 |
| 37 class GpuCommandBufferStub | 38 class GpuCommandBufferStub |
| 38 : public IPC::Channel::Listener, | 39 : public IPC::Channel::Listener, |
| 39 public IPC::Message::Sender, | 40 public IPC::Message::Sender, |
| 40 public base::SupportsWeakPtr<GpuCommandBufferStub> { | 41 public base::SupportsWeakPtr<GpuCommandBufferStub> { |
| 41 public: | 42 public: |
| 42 GpuCommandBufferStub( | 43 GpuCommandBufferStub( |
| 43 GpuChannel* channel, | 44 GpuChannel* channel, |
| 44 GpuCommandBufferStub* share_group, | 45 GpuCommandBufferStub* share_group, |
| 45 gfx::PluginWindowHandle handle, | 46 gfx::PluginWindowHandle handle, |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 66 | 67 |
| 67 // Whether this command buffer needs to be polled again in the future. | 68 // Whether this command buffer needs to be polled again in the future. |
| 68 bool HasMoreWork(); | 69 bool HasMoreWork(); |
| 69 | 70 |
| 70 // Set the swap interval according to the command line. | 71 // Set the swap interval according to the command line. |
| 71 void SetSwapInterval(); | 72 void SetSwapInterval(); |
| 72 | 73 |
| 73 gpu::gles2::GLES2Decoder* decoder() const { return decoder_.get(); } | 74 gpu::gles2::GLES2Decoder* decoder() const { return decoder_.get(); } |
| 74 gpu::GpuScheduler* scheduler() const { return scheduler_.get(); } | 75 gpu::GpuScheduler* scheduler() const { return scheduler_.get(); } |
| 75 | 76 |
| 77 // visibility state of associated render widgets. | |
|
nduca
2012/01/27 10:10:13
Visibility, upper cap
| |
| 78 // Note: This is only valid once last_used_time is != kUnknownLastUsedTime | |
| 79 bool visible() const { return visible_; } | |
|
nduca
2012/01/27 10:10:13
Please make a visibility_known accessor and update
| |
| 80 | |
| 81 // last_used_time is updated during visibility changes, and can be used for | |
|
nduca
2012/01/27 10:10:13
// Comments are sentences and thus the first word
| |
| 82 // LRU ordering in combination with visibility state | |
|
nduca
2012/01/27 10:10:13
Not sure the lru comment is useful here.
Why are
mmocny
2012/01/27 19:51:33
For no good reason whatsoever. Changed, thanks.
O
| |
| 83 static const int64 kUnknownLastUsedTime = 0; | |
| 84 int64 last_used_time() const { return last_used_time_; } | |
| 85 | |
| 76 // Identifies the target surface. | 86 // Identifies the target surface. |
| 77 int32 surface_id() const { return surface_id_; } | 87 int32 surface_id() const { return surface_id_; } |
| 78 | 88 |
| 79 // Identifies the various GpuCommandBufferStubs in the GPU process belonging | 89 // Identifies the various GpuCommandBufferStubs in the GPU process belonging |
| 80 // to the same renderer process. | 90 // to the same renderer process. |
| 81 int32 route_id() const { return route_id_; } | 91 int32 route_id() const { return route_id_; } |
| 82 | 92 |
| 93 // Return the ids of RenderWidgets which have identified as using this stub | |
| 94 std::vector<int> render_widget_ids() const; | |
|
nduca
2012/01/27 10:10:13
Consistency!
affected_render_widget_ids.
Then yo
| |
| 95 | |
| 83 gfx::GpuPreference gpu_preference() { return gpu_preference_; } | 96 gfx::GpuPreference gpu_preference() { return gpu_preference_; } |
| 84 | 97 |
| 85 // Sends a message to the console. | 98 // Sends a message to the console. |
| 86 void SendConsoleMessage(int32 id, const std::string& message); | 99 void SendConsoleMessage(int32 id, const std::string& message); |
| 87 | 100 |
| 101 void SetMemoryAllocation(GpuMemoryAllocation const& allocation); | |
|
nduca
2012/01/27 10:10:13
This sends not sets, right? Call things by what th
| |
| 102 | |
| 88 private: | 103 private: |
| 89 void Destroy(); | 104 void Destroy(); |
| 90 | 105 |
| 91 // Cleans up and sends reply if OnInitialize failed. | 106 // Cleans up and sends reply if OnInitialize failed. |
| 92 void OnInitializeFailed(IPC::Message* reply_message); | 107 void OnInitializeFailed(IPC::Message* reply_message); |
| 93 | 108 |
| 94 // Message handlers: | 109 // Message handlers: |
| 95 void OnInitialize(IPC::Message* reply_message); | 110 void OnInitialize(IPC::Message* reply_message); |
| 96 void OnSetGetBuffer(int32 shm_id, IPC::Message* reply_message); | 111 void OnSetGetBuffer(int32 shm_id, IPC::Message* reply_message); |
| 97 void OnSetParent(int32 parent_route_id, | 112 void OnSetParent(int32 parent_route_id, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 | 149 |
| 135 gfx::PluginWindowHandle handle_; | 150 gfx::PluginWindowHandle handle_; |
| 136 gfx::Size initial_size_; | 151 gfx::Size initial_size_; |
| 137 gpu::gles2::DisallowedFeatures disallowed_features_; | 152 gpu::gles2::DisallowedFeatures disallowed_features_; |
| 138 std::string allowed_extensions_; | 153 std::string allowed_extensions_; |
| 139 std::vector<int32> requested_attribs_; | 154 std::vector<int32> requested_attribs_; |
| 140 gfx::GpuPreference gpu_preference_; | 155 gfx::GpuPreference gpu_preference_; |
| 141 int32 route_id_; | 156 int32 route_id_; |
| 142 bool software_; | 157 bool software_; |
| 143 uint32 last_flush_count_; | 158 uint32 last_flush_count_; |
| 159 bool visible_; | |
| 160 int64 last_used_time_; | |
| 144 | 161 |
| 145 // Identifies the window for the rendering results on the browser side. | 162 // Identifies the window for the rendering results on the browser side. |
| 146 int32 surface_id_; | 163 int32 surface_id_; |
| 147 | 164 |
| 148 scoped_ptr<gpu::CommandBufferService> command_buffer_; | 165 scoped_ptr<gpu::CommandBufferService> command_buffer_; |
| 149 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; | 166 scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; |
| 150 scoped_ptr<gpu::GpuScheduler> scheduler_; | 167 scoped_ptr<gpu::GpuScheduler> scheduler_; |
| 151 scoped_refptr<gfx::GLContext> context_; | 168 scoped_refptr<gfx::GLContext> context_; |
| 152 scoped_refptr<gfx::GLSurface> surface_; | 169 scoped_refptr<gfx::GLSurface> surface_; |
| 153 | 170 |
| 154 // SetParent may be called before Initialize, in which case we need to keep | 171 // SetParent may be called before Initialize, in which case we need to keep |
| 155 // around the parent stub, so that Initialize can set the parent correctly. | 172 // around the parent stub, so that Initialize can set the parent correctly. |
| 156 base::WeakPtr<GpuCommandBufferStub> parent_stub_for_initialization_; | 173 base::WeakPtr<GpuCommandBufferStub> parent_stub_for_initialization_; |
| 157 uint32 parent_texture_for_initialization_; | 174 uint32 parent_texture_for_initialization_; |
| 158 | 175 |
| 159 GpuWatchdog* watchdog_; | 176 GpuWatchdog* watchdog_; |
| 160 | 177 |
| 161 // Zero or more video decoders owned by this stub, keyed by their | 178 // Zero or more video decoders owned by this stub, keyed by their |
| 162 // decoder_route_id. | 179 // decoder_route_id. |
| 163 IDMap<GpuVideoDecodeAccelerator, IDMapOwnPointer> video_decoders_; | 180 IDMap<GpuVideoDecodeAccelerator, IDMapOwnPointer> video_decoders_; |
| 164 | 181 |
| 165 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); | 182 DISALLOW_COPY_AND_ASSIGN(GpuCommandBufferStub); |
| 166 }; | 183 }; |
| 167 | 184 |
| 168 #endif // defined(ENABLE_GPU) | 185 #endif // defined(ENABLE_GPU) |
| 169 | 186 |
| 170 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ | 187 #endif // CONTENT_COMMON_GPU_GPU_COMMAND_BUFFER_STUB_H_ |
| OLD | NEW |