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

Side by Side Diff: services/ui/common/gpu_service.cc

Issue 2194893002: services/ui: Revert CLs that broke Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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
« no previous file with comments | « services/ui/common/gpu_service.h ('k') | services/ui/common/switches.h » ('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 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/common/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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 CHECK(io_thread_.StartWithOptions(thread_options)); 45 CHECK(io_thread_.StartWithOptions(thread_options));
46 } 46 }
47 47
48 GpuService::~GpuService() { 48 GpuService::~GpuService() {
49 DCHECK(IsMainThread()); 49 DCHECK(IsMainThread());
50 if (gpu_channel_) 50 if (gpu_channel_)
51 gpu_channel_->DestroyChannel(); 51 gpu_channel_->DestroyChannel();
52 } 52 }
53 53
54 // static 54 // static
55 bool GpuService::UseChromeGpuCommandBuffer() {
56 // TODO(penghuang): Kludge: Running with Chrome GPU command buffer by default
57 // breaks unit tests on Windows
58 #if defined(OS_WIN)
59 return false;
60 #else
61 return !base::CommandLine::ForCurrentProcess()->HasSwitch(
62 switches::kUseMojoGpuCommandBufferInMus);
63 #endif
64 }
65
66 // static
55 void GpuService::Initialize(shell::Connector* connector) { 67 void GpuService::Initialize(shell::Connector* connector) {
56 DCHECK(!g_gpu_service); 68 DCHECK(!g_gpu_service);
57 g_gpu_service = new GpuService(connector); 69 g_gpu_service = new GpuService(connector);
58 } 70 }
59 71
60 // static 72 // static
61 void GpuService::Terminate() { 73 void GpuService::Terminate() {
62 DCHECK(g_gpu_service); 74 DCHECK(g_gpu_service);
63 delete g_gpu_service; 75 delete g_gpu_service;
64 g_gpu_service = nullptr; 76 g_gpu_service = nullptr;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 MojoResult result = mojo::UnwrapSharedMemoryHandle( 244 MojoResult result = mojo::UnwrapSharedMemoryHandle(
233 std::move(handle), &platform_handle, &shared_memory_size, &readonly); 245 std::move(handle), &platform_handle, &shared_memory_size, &readonly);
234 if (result != MOJO_RESULT_OK) 246 if (result != MOJO_RESULT_OK)
235 return nullptr; 247 return nullptr;
236 DCHECK_EQ(shared_memory_size, size); 248 DCHECK_EQ(shared_memory_size, size);
237 249
238 return base::MakeUnique<base::SharedMemory>(platform_handle, readonly); 250 return base::MakeUnique<base::SharedMemory>(platform_handle, readonly);
239 } 251 }
240 252
241 } // namespace ui 253 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/common/gpu_service.h ('k') | services/ui/common/switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698