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

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

Issue 2184943002: services/ui: Move some files into the client lib. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chrome-gpu-in-mus-windows
Patch Set: . Created 4 years, 4 months 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/common/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"
11 #include "mojo/public/cpp/bindings/sync_call_restrictions.h" 11 #include "mojo/public/cpp/bindings/sync_call_restrictions.h"
12 #include "mojo/public/cpp/system/platform_handle.h" 12 #include "mojo/public/cpp/system/platform_handle.h"
13 #include "services/shell/public/cpp/connector.h" 13 #include "services/shell/public/cpp/connector.h"
14 #include "services/ui/common/gpu_type_converters.h" 14 #include "services/ui/common/gpu_type_converters.h"
15 #include "services/ui/common/mojo_gpu_memory_buffer_manager.h"
16 #include "services/ui/common/switches.h" 15 #include "services/ui/common/switches.h"
16 #include "services/ui/public/cpp/mojo_gpu_memory_buffer_manager.h"
17 #include "services/ui/public/interfaces/gpu_service.mojom.h" 17 #include "services/ui/public/interfaces/gpu_service.mojom.h"
18 18
19 namespace ui { 19 namespace ui {
20 20
21 namespace { 21 namespace {
22 22
23 void PostTask(scoped_refptr<base::SingleThreadTaskRunner> runner, 23 void PostTask(scoped_refptr<base::SingleThreadTaskRunner> runner,
24 const tracked_objects::Location& from_here, 24 const tracked_objects::Location& from_here,
25 const base::Closure& callback) { 25 const base::Closure& callback) {
26 runner->PostTask(from_here, callback); 26 runner->PostTask(from_here, callback);
27 } 27 }
28 28
29 GpuService* g_gpu_service = nullptr; 29 GpuService* g_gpu_service = nullptr;
Peng 2016/07/28 13:02:29 This global variable has to be in a shared library
sadrul 2016/07/28 13:32:14 Indeed. That's why I am making the client lib into
30 } 30 }
31 31
32 GpuService::GpuService(shell::Connector* connector) 32 GpuService::GpuService(shell::Connector* connector)
33 : main_task_runner_(base::ThreadTaskRunnerHandle::Get()), 33 : main_task_runner_(base::ThreadTaskRunnerHandle::Get()),
34 connector_(connector), 34 connector_(connector),
35 shutdown_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, 35 shutdown_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
36 base::WaitableEvent::InitialState::NOT_SIGNALED), 36 base::WaitableEvent::InitialState::NOT_SIGNALED),
37 io_thread_("GPUIOThread"), 37 io_thread_("GPUIOThread"),
38 gpu_memory_buffer_manager_(new MojoGpuMemoryBufferManager), 38 gpu_memory_buffer_manager_(new MojoGpuMemoryBufferManager),
39 is_establishing_(false), 39 is_establishing_(false),
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 MojoResult result = mojo::UnwrapSharedMemoryHandle( 232 MojoResult result = mojo::UnwrapSharedMemoryHandle(
233 std::move(handle), &platform_handle, &shared_memory_size, &readonly); 233 std::move(handle), &platform_handle, &shared_memory_size, &readonly);
234 if (result != MOJO_RESULT_OK) 234 if (result != MOJO_RESULT_OK)
235 return nullptr; 235 return nullptr;
236 DCHECK_EQ(shared_memory_size, size); 236 DCHECK_EQ(shared_memory_size, size);
237 237
238 return base::MakeUnique<base::SharedMemory>(platform_handle, readonly); 238 return base::MakeUnique<base::SharedMemory>(platform_handle, readonly);
239 } 239 }
240 240
241 } // namespace ui 241 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698