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/public/cpp/gpu_service.h" | 5 #include "services/ui/public/cpp/gpu_service.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 107 |
108 void GpuService::OnEstablishedGpuChannel( | 108 void GpuService::OnEstablishedGpuChannel( |
109 int client_id, | 109 int client_id, |
110 mojo::ScopedMessagePipeHandle channel_handle, | 110 mojo::ScopedMessagePipeHandle channel_handle, |
111 const gpu::GPUInfo& gpu_info) { | 111 const gpu::GPUInfo& gpu_info) { |
112 DCHECK(IsMainThread()); | 112 DCHECK(IsMainThread()); |
113 DCHECK(gpu_service_.get()); | 113 DCHECK(gpu_service_.get()); |
114 DCHECK(!gpu_channel_); | 114 DCHECK(!gpu_channel_); |
115 | 115 |
116 if (client_id) { | 116 if (client_id) { |
117 // TODO(penghuang): Get the real gpu info from mus. | |
118 gpu_channel_ = gpu::GpuChannelHost::Create( | 117 gpu_channel_ = gpu::GpuChannelHost::Create( |
119 this, client_id, gpu::GPUInfo(), | 118 this, client_id, gpu_info, IPC::ChannelHandle(channel_handle.release()), |
120 IPC::ChannelHandle(channel_handle.release()), &shutdown_event_, | 119 &shutdown_event_, gpu_memory_buffer_manager_.get()); |
121 gpu_memory_buffer_manager_.get()); | |
122 } | 120 } |
123 | 121 |
124 gpu_service_.reset(); | 122 gpu_service_.reset(); |
125 for (const auto& i : establish_callbacks_) | 123 for (const auto& i : establish_callbacks_) |
126 i.Run(gpu_channel_); | 124 i.Run(gpu_channel_); |
127 establish_callbacks_.clear(); | 125 establish_callbacks_.clear(); |
128 } | 126 } |
129 | 127 |
130 bool GpuService::IsMainThread() { | 128 bool GpuService::IsMainThread() { |
131 return main_task_runner_->BelongsToCurrentThread(); | 129 return main_task_runner_->BelongsToCurrentThread(); |
(...skipping 17 matching lines...) Expand all Loading... |
149 MojoResult result = mojo::UnwrapSharedMemoryHandle( | 147 MojoResult result = mojo::UnwrapSharedMemoryHandle( |
150 std::move(handle), &platform_handle, &shared_memory_size, &readonly); | 148 std::move(handle), &platform_handle, &shared_memory_size, &readonly); |
151 if (result != MOJO_RESULT_OK) | 149 if (result != MOJO_RESULT_OK) |
152 return nullptr; | 150 return nullptr; |
153 DCHECK_EQ(shared_memory_size, size); | 151 DCHECK_EQ(shared_memory_size, size); |
154 | 152 |
155 return base::MakeUnique<base::SharedMemory>(platform_handle, readonly); | 153 return base::MakeUnique<base::SharedMemory>(platform_handle, readonly); |
156 } | 154 } |
157 | 155 |
158 } // namespace ui | 156 } // namespace ui |
OLD | NEW |