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

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

Issue 2516883003: mus-gpu: Allow connection request to gpu to fail. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | services/ui/public/interfaces/gpu_service.mojom » ('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/public/cpp/gpu/gpu_service.h" 5 #include "services/ui/public/cpp/gpu/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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } 106 }
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 && channel_handle.is_valid()) {
117 gpu_channel_ = gpu::GpuChannelHost::Create( 117 gpu_channel_ = gpu::GpuChannelHost::Create(
118 this, client_id, gpu_info, IPC::ChannelHandle(channel_handle.release()), 118 this, client_id, gpu_info, IPC::ChannelHandle(channel_handle.release()),
119 &shutdown_event_, gpu_memory_buffer_manager_.get()); 119 &shutdown_event_, gpu_memory_buffer_manager_.get());
120 } 120 }
121 121
122 gpu_service_.reset(); 122 gpu_service_.reset();
123 for (const auto& i : establish_callbacks_) 123 for (const auto& i : establish_callbacks_)
124 i.Run(gpu_channel_); 124 i.Run(gpu_channel_);
125 establish_callbacks_.clear(); 125 establish_callbacks_.clear();
126 } 126 }
(...skipping 20 matching lines...) Expand all
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 | « no previous file | services/ui/public/interfaces/gpu_service.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698