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

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

Issue 2257693002: services/ui: Use a gpu::GpuChannelHost when creating ui::OutputSurface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mus-demo 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/gles2_context.h" 5 #include "services/ui/public/cpp/gles2_context.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
11 11
12 #include "gpu/command_buffer/client/gles2_cmd_helper.h" 12 #include "gpu/command_buffer/client/gles2_cmd_helper.h"
13 #include "gpu/command_buffer/client/shared_memory_limits.h" 13 #include "gpu/command_buffer/client/shared_memory_limits.h"
14 #include "gpu/command_buffer/client/transfer_buffer.h" 14 #include "gpu/command_buffer/client/transfer_buffer.h"
15 #include "gpu/ipc/client/command_buffer_proxy_impl.h" 15 #include "gpu/ipc/client/command_buffer_proxy_impl.h"
16 #include "gpu/ipc/client/gpu_channel_host.h" 16 #include "gpu/ipc/client/gpu_channel_host.h"
17 #include "mojo/public/cpp/system/core.h" 17 #include "mojo/public/cpp/system/core.h"
18 #include "services/ui/public/cpp/gpu_service.h" 18 #include "services/ui/public/cpp/gpu_service.h"
19 #include "services/ui/public/interfaces/gpu_service.mojom.h" 19 #include "services/ui/public/interfaces/gpu_service.mojom.h"
20 #include "url/gurl.h" 20 #include "url/gurl.h"
21 21
22 namespace ui { 22 namespace ui {
23 23
24 GLES2Context::GLES2Context() {} 24 GLES2Context::GLES2Context() {}
25 25
26 GLES2Context::~GLES2Context() {} 26 GLES2Context::~GLES2Context() {}
27 27
28 bool GLES2Context::Initialize(GpuService* gpu_service) { 28 bool GLES2Context::Initialize(
29 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host = 29 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host) {
30 gpu_service->EstablishGpuChannelSync(); 30 DCHECK(gpu_channel_host);
31 if (!gpu_channel_host)
32 return false;
33 gpu::SurfaceHandle surface_handle = gfx::kNullAcceleratedWidget; 31 gpu::SurfaceHandle surface_handle = gfx::kNullAcceleratedWidget;
34 // TODO(penghuang): support shared group. 32 // TODO(penghuang): support shared group.
35 gpu::CommandBufferProxyImpl* shared_command_buffer = nullptr; 33 gpu::CommandBufferProxyImpl* shared_command_buffer = nullptr;
36 gpu::GpuStreamId stream_id = gpu::GpuStreamId::GPU_STREAM_DEFAULT; 34 gpu::GpuStreamId stream_id = gpu::GpuStreamId::GPU_STREAM_DEFAULT;
37 gpu::GpuStreamPriority stream_priority = gpu::GpuStreamPriority::NORMAL; 35 gpu::GpuStreamPriority stream_priority = gpu::GpuStreamPriority::NORMAL;
38 gpu::gles2::ContextCreationAttribHelper attributes; 36 gpu::gles2::ContextCreationAttribHelper attributes;
39 // TODO(penghuang): figure a useful active_url. 37 // TODO(penghuang): figure a useful active_url.
40 GURL active_url; 38 GURL active_url;
41 scoped_refptr<base::SingleThreadTaskRunner> task_runner = 39 scoped_refptr<base::SingleThreadTaskRunner> task_runner =
42 base::ThreadTaskRunnerHandle::Get(); 40 base::ThreadTaskRunnerHandle::Get();
(...skipping 26 matching lines...) Expand all
69 if (!implementation_->Initialize(default_limits.start_transfer_buffer_size, 67 if (!implementation_->Initialize(default_limits.start_transfer_buffer_size,
70 default_limits.min_transfer_buffer_size, 68 default_limits.min_transfer_buffer_size,
71 default_limits.max_transfer_buffer_size, 69 default_limits.max_transfer_buffer_size,
72 default_limits.mapped_memory_reclaim_limit)) 70 default_limits.mapped_memory_reclaim_limit))
73 return false; 71 return false;
74 return true; 72 return true;
75 } 73 }
76 74
77 // static 75 // static
78 std::unique_ptr<GLES2Context> GLES2Context::CreateOffscreenContext( 76 std::unique_ptr<GLES2Context> GLES2Context::CreateOffscreenContext(
79 GpuService* gpu_service) { 77 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host) {
78 if (!gpu_channel_host)
79 return nullptr;
80 std::unique_ptr<GLES2Context> gles2_context(new GLES2Context); 80 std::unique_ptr<GLES2Context> gles2_context(new GLES2Context);
sky 2016/08/18 13:15:45 This section is subtle and worth a comment. For ex
sadrul 2016/08/18 14:59:48 We keep the context if it was successfully initial
sky 2016/08/18 19:12:09 Makes sense, please add a comment to the code as w
sadrul 2016/08/18 20:53:28 Done.
81 if (!gles2_context->Initialize(gpu_service)) 81 if (!gles2_context->Initialize(std::move(gpu_channel_host)))
82 gles2_context.reset(); 82 gles2_context.reset();
83 return gles2_context; 83 return gles2_context;
84 } 84 }
85 85
86 } // namespace ui 86 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698