| 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 #include "content/common/gpu/client/gpu_channel_host.h" | 5 #include "content/common/gpu/client/gpu_channel_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 } else if (base::MessageLoop::current()) { | 103 } else if (base::MessageLoop::current()) { |
| 104 return sync_filter_->Send(message.release()); | 104 return sync_filter_->Send(message.release()); |
| 105 } | 105 } |
| 106 | 106 |
| 107 return false; | 107 return false; |
| 108 } | 108 } |
| 109 | 109 |
| 110 CommandBufferProxyImpl* GpuChannelHost::CreateViewCommandBuffer( | 110 CommandBufferProxyImpl* GpuChannelHost::CreateViewCommandBuffer( |
| 111 int32 surface_id, | 111 int32 surface_id, |
| 112 CommandBufferProxyImpl* share_group, | 112 CommandBufferProxyImpl* share_group, |
| 113 const std::string& allowed_extensions, | |
| 114 const std::vector<int32>& attribs, | 113 const std::vector<int32>& attribs, |
| 115 const GURL& active_url, | 114 const GURL& active_url, |
| 116 gfx::GpuPreference gpu_preference) { | 115 gfx::GpuPreference gpu_preference) { |
| 117 TRACE_EVENT1("gpu", | 116 TRACE_EVENT1("gpu", |
| 118 "GpuChannelHost::CreateViewCommandBuffer", | 117 "GpuChannelHost::CreateViewCommandBuffer", |
| 119 "surface_id", | 118 "surface_id", |
| 120 surface_id); | 119 surface_id); |
| 121 | 120 |
| 122 GPUCreateCommandBufferConfig init_params; | 121 GPUCreateCommandBufferConfig init_params; |
| 123 init_params.share_group_id = | 122 init_params.share_group_id = |
| 124 share_group ? share_group->GetRouteID() : MSG_ROUTING_NONE; | 123 share_group ? share_group->GetRouteID() : MSG_ROUTING_NONE; |
| 125 init_params.allowed_extensions = allowed_extensions; | |
| 126 init_params.attribs = attribs; | 124 init_params.attribs = attribs; |
| 127 init_params.active_url = active_url; | 125 init_params.active_url = active_url; |
| 128 init_params.gpu_preference = gpu_preference; | 126 init_params.gpu_preference = gpu_preference; |
| 129 int32 route_id = factory_->CreateViewCommandBuffer(surface_id, init_params); | 127 int32 route_id = factory_->CreateViewCommandBuffer(surface_id, init_params); |
| 130 if (route_id == MSG_ROUTING_NONE) | 128 if (route_id == MSG_ROUTING_NONE) |
| 131 return NULL; | 129 return NULL; |
| 132 | 130 |
| 133 CommandBufferProxyImpl* command_buffer = | 131 CommandBufferProxyImpl* command_buffer = |
| 134 new CommandBufferProxyImpl(this, route_id); | 132 new CommandBufferProxyImpl(this, route_id); |
| 135 AddRoute(route_id, command_buffer->AsWeakPtr()); | 133 AddRoute(route_id, command_buffer->AsWeakPtr()); |
| 136 | 134 |
| 137 AutoLock lock(context_lock_); | 135 AutoLock lock(context_lock_); |
| 138 proxies_[route_id] = command_buffer; | 136 proxies_[route_id] = command_buffer; |
| 139 return command_buffer; | 137 return command_buffer; |
| 140 } | 138 } |
| 141 | 139 |
| 142 CommandBufferProxyImpl* GpuChannelHost::CreateOffscreenCommandBuffer( | 140 CommandBufferProxyImpl* GpuChannelHost::CreateOffscreenCommandBuffer( |
| 143 const gfx::Size& size, | 141 const gfx::Size& size, |
| 144 CommandBufferProxyImpl* share_group, | 142 CommandBufferProxyImpl* share_group, |
| 145 const std::string& allowed_extensions, | |
| 146 const std::vector<int32>& attribs, | 143 const std::vector<int32>& attribs, |
| 147 const GURL& active_url, | 144 const GURL& active_url, |
| 148 gfx::GpuPreference gpu_preference) { | 145 gfx::GpuPreference gpu_preference) { |
| 149 TRACE_EVENT0("gpu", "GpuChannelHost::CreateOffscreenCommandBuffer"); | 146 TRACE_EVENT0("gpu", "GpuChannelHost::CreateOffscreenCommandBuffer"); |
| 150 | 147 |
| 151 GPUCreateCommandBufferConfig init_params; | 148 GPUCreateCommandBufferConfig init_params; |
| 152 init_params.share_group_id = | 149 init_params.share_group_id = |
| 153 share_group ? share_group->GetRouteID() : MSG_ROUTING_NONE; | 150 share_group ? share_group->GetRouteID() : MSG_ROUTING_NONE; |
| 154 init_params.allowed_extensions = allowed_extensions; | |
| 155 init_params.attribs = attribs; | 151 init_params.attribs = attribs; |
| 156 init_params.active_url = active_url; | 152 init_params.active_url = active_url; |
| 157 init_params.gpu_preference = gpu_preference; | 153 init_params.gpu_preference = gpu_preference; |
| 158 int32 route_id; | 154 int32 route_id; |
| 159 if (!Send(new GpuChannelMsg_CreateOffscreenCommandBuffer(size, | 155 if (!Send(new GpuChannelMsg_CreateOffscreenCommandBuffer(size, |
| 160 init_params, | 156 init_params, |
| 161 &route_id))) { | 157 &route_id))) { |
| 162 return NULL; | 158 return NULL; |
| 163 } | 159 } |
| 164 | 160 |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 AutoLock lock(lock_); | 408 AutoLock lock(lock_); |
| 413 DCHECK_LE(names.size(), requested_mailboxes_); | 409 DCHECK_LE(names.size(), requested_mailboxes_); |
| 414 requested_mailboxes_ -= names.size(); | 410 requested_mailboxes_ -= names.size(); |
| 415 mailbox_name_pool_.insert(mailbox_name_pool_.end(), | 411 mailbox_name_pool_.insert(mailbox_name_pool_.end(), |
| 416 names.begin(), | 412 names.begin(), |
| 417 names.end()); | 413 names.end()); |
| 418 } | 414 } |
| 419 | 415 |
| 420 | 416 |
| 421 } // namespace content | 417 } // namespace content |
| OLD | NEW |