Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Side by Side Diff: services/ui/public/cpp/gpu/gpu_service.cc

Issue 2562623005: mus/gpu: Rename the client/server side memory buffer managers. (Closed)
Patch Set: tot merge Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/gpu_service.h" 5 #include "services/ui/public/cpp/gpu/gpu_service.h"
6 6
7 #include "base/threading/thread_task_runner_handle.h" 7 #include "base/threading/thread_task_runner_handle.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "mojo/public/cpp/bindings/sync_call_restrictions.h" 9 #include "mojo/public/cpp/bindings/sync_call_restrictions.h"
10 #include "mojo/public/cpp/system/platform_handle.h" 10 #include "mojo/public/cpp/system/platform_handle.h"
11 #include "services/service_manager/public/cpp/connector.h" 11 #include "services/service_manager/public/cpp/connector.h"
12 #include "services/ui/public/cpp/gpu/mojo_gpu_memory_buffer_manager.h" 12 #include "services/ui/public/cpp/gpu/client_gpu_memory_buffer_manager.h"
13 #include "services/ui/public/interfaces/constants.mojom.h" 13 #include "services/ui/public/interfaces/constants.mojom.h"
14 #include "services/ui/public/interfaces/gpu_service.mojom.h" 14 #include "services/ui/public/interfaces/gpu_service.mojom.h"
15 15
16 namespace ui { 16 namespace ui {
17 17
18 GpuService::GpuService(service_manager::Connector* connector, 18 GpuService::GpuService(service_manager::Connector* connector,
19 scoped_refptr<base::SingleThreadTaskRunner> task_runner) 19 scoped_refptr<base::SingleThreadTaskRunner> task_runner)
20 : main_task_runner_(base::ThreadTaskRunnerHandle::Get()), 20 : main_task_runner_(base::ThreadTaskRunnerHandle::Get()),
21 io_task_runner_(std::move(task_runner)), 21 io_task_runner_(std::move(task_runner)),
22 connector_(connector), 22 connector_(connector),
23 shutdown_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, 23 shutdown_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
24 base::WaitableEvent::InitialState::NOT_SIGNALED) { 24 base::WaitableEvent::InitialState::NOT_SIGNALED) {
25 DCHECK(main_task_runner_); 25 DCHECK(main_task_runner_);
26 DCHECK(connector_); 26 DCHECK(connector_);
27 mojom::GpuServicePtr gpu_service_ptr; 27 mojom::GpuServicePtr gpu_service_ptr;
28 connector_->ConnectToInterface(ui::mojom::kServiceName, &gpu_service_ptr); 28 connector_->ConnectToInterface(ui::mojom::kServiceName, &gpu_service_ptr);
29 gpu_memory_buffer_manager_ = 29 gpu_memory_buffer_manager_ = base::MakeUnique<ClientGpuMemoryBufferManager>(
30 base::MakeUnique<MojoGpuMemoryBufferManager>(std::move(gpu_service_ptr)); 30 std::move(gpu_service_ptr));
31 if (!io_task_runner_) { 31 if (!io_task_runner_) {
32 io_thread_.reset(new base::Thread("GPUIOThread")); 32 io_thread_.reset(new base::Thread("GPUIOThread"));
33 base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0); 33 base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0);
34 thread_options.priority = base::ThreadPriority::NORMAL; 34 thread_options.priority = base::ThreadPriority::NORMAL;
35 CHECK(io_thread_->StartWithOptions(thread_options)); 35 CHECK(io_thread_->StartWithOptions(thread_options));
36 io_task_runner_ = io_thread_->task_runner(); 36 io_task_runner_ = io_thread_->task_runner();
37 } 37 }
38 } 38 }
39 39
40 GpuService::~GpuService() { 40 GpuService::~GpuService() {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 MojoResult result = mojo::UnwrapSharedMemoryHandle( 147 MojoResult result = mojo::UnwrapSharedMemoryHandle(
148 std::move(handle), &platform_handle, &shared_memory_size, &readonly); 148 std::move(handle), &platform_handle, &shared_memory_size, &readonly);
149 if (result != MOJO_RESULT_OK) 149 if (result != MOJO_RESULT_OK)
150 return nullptr; 150 return nullptr;
151 DCHECK_EQ(shared_memory_size, size); 151 DCHECK_EQ(shared_memory_size, size);
152 152
153 return base::MakeUnique<base::SharedMemory>(platform_handle, readonly); 153 return base::MakeUnique<base::SharedMemory>(platform_handle, readonly);
154 } 154 }
155 155
156 } // namespace ui 156 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/public/cpp/gpu/gpu_service.h ('k') | services/ui/public/cpp/gpu/mojo_gpu_memory_buffer_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698