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

Side by Side Diff: services/ui/public/cpp/mojo_gpu_memory_buffer_manager.cc

Issue 2503063003: Add service name constant for UI service. (Closed)
Patch Set: . Created 4 years, 1 month 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
« no previous file with comments | « services/ui/public/cpp/gpu_service.cc ('k') | services/ui/public/cpp/window_tree_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/mojo_gpu_memory_buffer_manager.h" 5 #include "services/ui/public/cpp/mojo_gpu_memory_buffer_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
11 #include "base/synchronization/waitable_event.h" 11 #include "base/synchronization/waitable_event.h"
12 #include "gpu/ipc/client/gpu_memory_buffer_impl.h" 12 #include "gpu/ipc/client/gpu_memory_buffer_impl.h"
13 #include "mojo/public/cpp/system/buffer.h" 13 #include "mojo/public/cpp/system/buffer.h"
14 #include "mojo/public/cpp/system/platform_handle.h" 14 #include "mojo/public/cpp/system/platform_handle.h"
15 #include "services/service_manager/public/cpp/connector.h" 15 #include "services/service_manager/public/cpp/connector.h"
16 #include "services/ui/public/interfaces/constants.mojom.h"
16 #include "ui/gfx/buffer_format_util.h" 17 #include "ui/gfx/buffer_format_util.h"
17 18
18 namespace ui { 19 namespace ui {
19 20
20 namespace { 21 namespace {
21 22
22 void OnGpuMemoryBufferAllocated(gfx::GpuMemoryBufferHandle* ret_handle, 23 void OnGpuMemoryBufferAllocated(gfx::GpuMemoryBufferHandle* ret_handle,
23 base::WaitableEvent* wait, 24 base::WaitableEvent* wait,
24 const gfx::GpuMemoryBufferHandle& handle) { 25 const gfx::GpuMemoryBufferHandle& handle) {
25 *ret_handle = handle; 26 *ret_handle = handle;
(...skipping 16 matching lines...) Expand all
42 } 43 }
43 44
44 MojoGpuMemoryBufferManager::~MojoGpuMemoryBufferManager() { 45 MojoGpuMemoryBufferManager::~MojoGpuMemoryBufferManager() {
45 thread_.task_runner()->PostTask( 46 thread_.task_runner()->PostTask(
46 FROM_HERE, base::Bind(&MojoGpuMemoryBufferManager::TearDownThread, 47 FROM_HERE, base::Bind(&MojoGpuMemoryBufferManager::TearDownThread,
47 base::Unretained(this))); 48 base::Unretained(this)));
48 thread_.Stop(); 49 thread_.Stop();
49 } 50 }
50 51
51 void MojoGpuMemoryBufferManager::InitThread() { 52 void MojoGpuMemoryBufferManager::InitThread() {
52 connector_->ConnectToInterface("ui", &gpu_service_); 53 connector_->ConnectToInterface(ui::mojom::kServiceName, &gpu_service_);
53 } 54 }
54 55
55 void MojoGpuMemoryBufferManager::TearDownThread() { 56 void MojoGpuMemoryBufferManager::TearDownThread() {
56 gpu_service_.reset(); 57 gpu_service_.reset();
57 } 58 }
58 59
59 void MojoGpuMemoryBufferManager::AllocateGpuMemoryBufferOnThread( 60 void MojoGpuMemoryBufferManager::AllocateGpuMemoryBufferOnThread(
60 const gfx::Size& size, 61 const gfx::Size& size,
61 gfx::BufferFormat format, 62 gfx::BufferFormat format,
62 gfx::BufferUsage usage, 63 gfx::BufferUsage usage,
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 128 }
128 129
129 void MojoGpuMemoryBufferManager::SetDestructionSyncToken( 130 void MojoGpuMemoryBufferManager::SetDestructionSyncToken(
130 gfx::GpuMemoryBuffer* buffer, 131 gfx::GpuMemoryBuffer* buffer,
131 const gpu::SyncToken& sync_token) { 132 const gpu::SyncToken& sync_token) {
132 static_cast<gpu::GpuMemoryBufferImpl*>(buffer)->set_destruction_sync_token( 133 static_cast<gpu::GpuMemoryBufferImpl*>(buffer)->set_destruction_sync_token(
133 sync_token); 134 sync_token);
134 } 135 }
135 136
136 } // namespace ui 137 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/public/cpp/gpu_service.cc ('k') | services/ui/public/cpp/window_tree_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698