| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/ui/gpu/gpu_service.h" | 5 #include "services/ui/gpu/gpu_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/crash_logging.h" |
| 8 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 11 #include "cc/output/in_process_context_provider.h" | 12 #include "cc/output/in_process_context_provider.h" |
| 12 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" | 13 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" |
| 13 #include "gpu/command_buffer/service/gpu_switches.h" | 14 #include "gpu/command_buffer/service/gpu_switches.h" |
| 14 #include "gpu/command_buffer/service/sync_point_manager.h" | 15 #include "gpu/command_buffer/service/sync_point_manager.h" |
| 15 #include "gpu/config/gpu_info_collector.h" | 16 #include "gpu/config/gpu_info_collector.h" |
| 16 #include "gpu/config/gpu_switches.h" | 17 #include "gpu/config/gpu_switches.h" |
| 17 #include "gpu/config/gpu_util.h" | 18 #include "gpu/config/gpu_util.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 145 |
| 145 #if defined(OS_WIN) | 146 #if defined(OS_WIN) |
| 146 void GpuService::SendAcceleratedSurfaceCreatedChildWindow( | 147 void GpuService::SendAcceleratedSurfaceCreatedChildWindow( |
| 147 gpu::SurfaceHandle parent_window, | 148 gpu::SurfaceHandle parent_window, |
| 148 gpu::SurfaceHandle child_window) { | 149 gpu::SurfaceHandle child_window) { |
| 149 gpu_host_->SetChildSurface(parent_window, child_window); | 150 gpu_host_->SetChildSurface(parent_window, child_window); |
| 150 } | 151 } |
| 151 #endif | 152 #endif |
| 152 | 153 |
| 153 void GpuService::SetActiveURL(const GURL& url) { | 154 void GpuService::SetActiveURL(const GURL& url) { |
| 154 // TODO(penghuang): implement this function. | 155 constexpr char kActiveURL[] = "url-chunk"; |
| 156 base::debug::SetCrashKeyValue(kActiveURL, url.possibly_invalid_spec()); |
| 155 } | 157 } |
| 156 | 158 |
| 157 void GpuService::EstablishGpuChannel( | 159 void GpuService::EstablishGpuChannel( |
| 158 int32_t client_id, | 160 int32_t client_id, |
| 159 uint64_t client_tracing_id, | 161 uint64_t client_tracing_id, |
| 160 bool is_gpu_host, | 162 bool is_gpu_host, |
| 161 const EstablishGpuChannelCallback& callback) { | 163 const EstablishGpuChannelCallback& callback) { |
| 162 DCHECK(CalledOnValidThread()); | 164 DCHECK(CalledOnValidThread()); |
| 163 | 165 |
| 164 if (!gpu_channel_manager_) { | 166 if (!gpu_channel_manager_) { |
| 165 callback.Run(mojo::ScopedMessagePipeHandle()); | 167 callback.Run(mojo::ScopedMessagePipeHandle()); |
| 166 return; | 168 return; |
| 167 } | 169 } |
| 168 | 170 |
| 169 const bool preempts = is_gpu_host; | 171 const bool preempts = is_gpu_host; |
| 170 const bool allow_view_command_buffers = is_gpu_host; | 172 const bool allow_view_command_buffers = is_gpu_host; |
| 171 const bool allow_real_time_streams = is_gpu_host; | 173 const bool allow_real_time_streams = is_gpu_host; |
| 172 mojo::ScopedMessagePipeHandle channel_handle; | 174 mojo::ScopedMessagePipeHandle channel_handle; |
| 173 IPC::ChannelHandle handle = gpu_channel_manager_->EstablishChannel( | 175 IPC::ChannelHandle handle = gpu_channel_manager_->EstablishChannel( |
| 174 client_id, client_tracing_id, preempts, allow_view_command_buffers, | 176 client_id, client_tracing_id, preempts, allow_view_command_buffers, |
| 175 allow_real_time_streams); | 177 allow_real_time_streams); |
| 176 channel_handle.reset(handle.mojo_handle); | 178 channel_handle.reset(handle.mojo_handle); |
| 177 media_gpu_channel_manager_->AddChannel(client_id); | 179 media_gpu_channel_manager_->AddChannel(client_id); |
| 178 callback.Run(std::move(channel_handle)); | 180 callback.Run(std::move(channel_handle)); |
| 179 } | 181 } |
| 180 | 182 |
| 181 } // namespace ui | 183 } // namespace ui |
| OLD | NEW |