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

Side by Side Diff: services/ui/ws/gpu_service_proxy.cc

Issue 2365753003: mus ws: Move 'reset(new' to base::MakeUnique. (Closed)
Patch Set: Merge with tot Created 4 years, 2 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/ws/frame_generator_unittest.cc ('k') | services/ui/ws/platform_display.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 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/ws/gpu_service_proxy.h" 5 #include "services/ui/ws/gpu_service_proxy.h"
6 6
7 #include "base/memory/shared_memory.h" 7 #include "base/memory/shared_memory.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 constexpr bool is_gpu_host = true; 51 constexpr bool is_gpu_host = true;
52 gpu_service_->EstablishGpuChannel( 52 gpu_service_->EstablishGpuChannel(
53 kInternalGpuChannelClientId, kInternalGpuChannelClientTracingId, 53 kInternalGpuChannelClientId, kInternalGpuChannelClientTracingId,
54 is_gpu_host, base::Bind(&GpuServiceProxy::OnInternalGpuChannelEstablished, 54 is_gpu_host, base::Bind(&GpuServiceProxy::OnInternalGpuChannelEstablished,
55 base::Unretained(this))); 55 base::Unretained(this)));
56 next_client_id_ = kInternalGpuChannelClientId + 1; 56 next_client_id_ = kInternalGpuChannelClientId + 1;
57 } 57 }
58 58
59 void GpuServiceProxy::OnInternalGpuChannelEstablished( 59 void GpuServiceProxy::OnInternalGpuChannelEstablished(
60 mojo::ScopedMessagePipeHandle channel_handle) { 60 mojo::ScopedMessagePipeHandle channel_handle) {
61 io_thread_.reset(new base::Thread("GPUIOThread")); 61 io_thread_ = base::MakeUnique<base::Thread>("GPUIOThread");
62 base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0); 62 base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0);
63 thread_options.priority = base::ThreadPriority::NORMAL; 63 thread_options.priority = base::ThreadPriority::NORMAL;
64 CHECK(io_thread_->StartWithOptions(thread_options)); 64 CHECK(io_thread_->StartWithOptions(thread_options));
65 65
66 gpu_memory_buffer_manager_.reset(new MusGpuMemoryBufferManager( 66 gpu_memory_buffer_manager_ = base::MakeUnique<MusGpuMemoryBufferManager>(
67 gpu_main_.gpu_service(), kInternalGpuChannelClientId)); 67 gpu_main_.gpu_service(), kInternalGpuChannelClientId);
68 gpu_channel_ = gpu::GpuChannelHost::Create( 68 gpu_channel_ = gpu::GpuChannelHost::Create(
69 this, kInternalGpuChannelClientId, gpu_info_, 69 this, kInternalGpuChannelClientId, gpu_info_,
70 IPC::ChannelHandle(channel_handle.release()), &shutdown_event_, 70 IPC::ChannelHandle(channel_handle.release()), &shutdown_event_,
71 gpu_memory_buffer_manager_.get()); 71 gpu_memory_buffer_manager_.get());
72 if (delegate_) 72 if (delegate_)
73 delegate_->OnGpuChannelEstablished(gpu_channel_); 73 delegate_->OnGpuChannelEstablished(gpu_channel_);
74 } 74 }
75 75
76 void GpuServiceProxy::OnGpuChannelEstablished( 76 void GpuServiceProxy::OnGpuChannelEstablished(
77 const EstablishGpuChannelCallback& callback, 77 const EstablishGpuChannelCallback& callback,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 std::unique_ptr<base::SharedMemory> GpuServiceProxy::AllocateSharedMemory( 120 std::unique_ptr<base::SharedMemory> GpuServiceProxy::AllocateSharedMemory(
121 size_t size) { 121 size_t size) {
122 std::unique_ptr<base::SharedMemory> shm(new base::SharedMemory()); 122 std::unique_ptr<base::SharedMemory> shm(new base::SharedMemory());
123 if (!shm->CreateAnonymous(size)) 123 if (!shm->CreateAnonymous(size))
124 shm.reset(); 124 shm.reset();
125 return shm; 125 return shm;
126 } 126 }
127 127
128 } // namespace ws 128 } // namespace ws
129 } // namespace ui 129 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/frame_generator_unittest.cc ('k') | services/ui/ws/platform_display.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698