| 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 "gpu/ipc/service/gpu_channel_manager.h" | 5 #include "gpu/ipc/service/gpu_channel_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 gpu_preferences_(gpu_preferences), | 59 gpu_preferences_(gpu_preferences), |
| 60 gpu_driver_bug_workarounds_(base::CommandLine::ForCurrentProcess()), | 60 gpu_driver_bug_workarounds_(base::CommandLine::ForCurrentProcess()), |
| 61 delegate_(delegate), | 61 delegate_(delegate), |
| 62 watchdog_(watchdog), | 62 watchdog_(watchdog), |
| 63 share_group_(new gl::GLShareGroup()), | 63 share_group_(new gl::GLShareGroup()), |
| 64 mailbox_manager_(gles2::MailboxManager::Create(gpu_preferences)), | 64 mailbox_manager_(gles2::MailboxManager::Create(gpu_preferences)), |
| 65 gpu_memory_manager_(this), | 65 gpu_memory_manager_(this), |
| 66 sync_point_manager_(sync_point_manager), | 66 sync_point_manager_(sync_point_manager), |
| 67 gpu_memory_buffer_factory_(gpu_memory_buffer_factory), | 67 gpu_memory_buffer_factory_(gpu_memory_buffer_factory), |
| 68 gpu_feature_info_(gpu_feature_info), | 68 gpu_feature_info_(gpu_feature_info), |
| 69 discardable_manager_(new ServiceDiscardableManager()), |
| 69 exiting_for_lost_context_(false), | 70 exiting_for_lost_context_(false), |
| 70 activity_flags_(std::move(activity_flags)), | 71 activity_flags_(std::move(activity_flags)), |
| 71 weak_factory_(this) { | 72 weak_factory_(this) { |
| 72 DCHECK(task_runner); | 73 DCHECK(task_runner); |
| 73 DCHECK(io_task_runner); | 74 DCHECK(io_task_runner); |
| 74 if (gpu_preferences_.ui_prioritize_in_gpu_process) | 75 if (gpu_preferences_.ui_prioritize_in_gpu_process) |
| 75 preemption_flag_ = new PreemptionFlag; | 76 preemption_flag_ = new PreemptionFlag; |
| 76 } | 77 } |
| 77 | 78 |
| 78 GpuChannelManager::~GpuChannelManager() { | 79 GpuChannelManager::~GpuChannelManager() { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 GpuChannel* GpuChannelManager::LookupChannel(int32_t client_id) const { | 125 GpuChannel* GpuChannelManager::LookupChannel(int32_t client_id) const { |
| 125 const auto& it = gpu_channels_.find(client_id); | 126 const auto& it = gpu_channels_.find(client_id); |
| 126 return it != gpu_channels_.end() ? it->second.get() : nullptr; | 127 return it != gpu_channels_.end() ? it->second.get() : nullptr; |
| 127 } | 128 } |
| 128 | 129 |
| 129 GpuChannel* GpuChannelManager::EstablishChannel(int client_id, | 130 GpuChannel* GpuChannelManager::EstablishChannel(int client_id, |
| 130 uint64_t client_tracing_id, | 131 uint64_t client_tracing_id, |
| 131 bool is_gpu_host) { | 132 bool is_gpu_host) { |
| 132 std::unique_ptr<GpuChannel> gpu_channel = base::MakeUnique<GpuChannel>( | 133 std::unique_ptr<GpuChannel> gpu_channel = base::MakeUnique<GpuChannel>( |
| 133 this, sync_point_manager_, watchdog_, share_group_, mailbox_manager_, | 134 this, sync_point_manager_, watchdog_, share_group_, mailbox_manager_, |
| 134 is_gpu_host ? preemption_flag_ : nullptr, | 135 discardable_manager_, is_gpu_host ? preemption_flag_ : nullptr, |
| 135 is_gpu_host ? nullptr : preemption_flag_, task_runner_, io_task_runner_, | 136 is_gpu_host ? nullptr : preemption_flag_, task_runner_, io_task_runner_, |
| 136 client_id, client_tracing_id, is_gpu_host); | 137 client_id, client_tracing_id, is_gpu_host); |
| 137 | 138 |
| 138 GpuChannel* gpu_channel_ptr = gpu_channel.get(); | 139 GpuChannel* gpu_channel_ptr = gpu_channel.get(); |
| 139 gpu_channels_[client_id] = std::move(gpu_channel); | 140 gpu_channels_[client_id] = std::move(gpu_channel); |
| 140 return gpu_channel_ptr; | 141 return gpu_channel_ptr; |
| 141 } | 142 } |
| 142 | 143 |
| 143 void GpuChannelManager::InternalDestroyGpuMemoryBuffer( | 144 void GpuChannelManager::InternalDestroyGpuMemoryBuffer( |
| 144 gfx::GpuMemoryBufferId id, | 145 gfx::GpuMemoryBufferId id, |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 } | 247 } |
| 247 } | 248 } |
| 248 if (!stub || !stub->decoder()->MakeCurrent()) | 249 if (!stub || !stub->decoder()->MakeCurrent()) |
| 249 return; | 250 return; |
| 250 glFinish(); | 251 glFinish(); |
| 251 DidAccessGpu(); | 252 DidAccessGpu(); |
| 252 } | 253 } |
| 253 #endif | 254 #endif |
| 254 | 255 |
| 255 } // namespace gpu | 256 } // namespace gpu |
| OLD | NEW |