OLD | NEW |
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 "mojo/public/cpp/system/core.h" | 16 #include "mojo/public/cpp/system/core.h" |
17 #include "services/shell/public/cpp/connector.h" | |
18 #include "services/ui/common/gpu_service.h" | 17 #include "services/ui/common/gpu_service.h" |
19 #include "services/ui/public/cpp/lib/command_buffer_client_impl.h" | 18 #include "services/ui/public/cpp/lib/command_buffer_client_impl.h" |
20 #include "services/ui/public/interfaces/command_buffer.mojom.h" | 19 #include "services/ui/public/interfaces/command_buffer.mojom.h" |
21 #include "services/ui/public/interfaces/gpu_service.mojom.h" | 20 #include "services/ui/public/interfaces/gpu_service.mojom.h" |
22 #include "url/gurl.h" | 21 #include "url/gurl.h" |
23 | 22 |
24 namespace ui { | 23 namespace ui { |
25 | 24 |
26 GLES2Context::GLES2Context() {} | 25 GLES2Context::GLES2Context() {} |
27 | 26 |
28 GLES2Context::~GLES2Context() {} | 27 GLES2Context::~GLES2Context() {} |
29 | 28 |
30 bool GLES2Context::Initialize(const std::vector<int32_t>& attribs, | 29 bool GLES2Context::Initialize(const std::vector<int32_t>& attribs) { |
31 shell::Connector* connector) { | |
32 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host = | 30 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host = |
33 GpuService::GetInstance()->EstablishGpuChannelSync(); | 31 GpuService::GetInstance()->EstablishGpuChannelSync(); |
34 if (!gpu_channel_host) | 32 if (!gpu_channel_host) |
35 return false; | 33 return false; |
36 gpu::SurfaceHandle surface_handle = gfx::kNullAcceleratedWidget; | 34 gpu::SurfaceHandle surface_handle = gfx::kNullAcceleratedWidget; |
37 // TODO(penghuang): support shared group. | 35 // TODO(penghuang): support shared group. |
38 gpu::CommandBufferProxyImpl* shared_command_buffer = nullptr; | 36 gpu::CommandBufferProxyImpl* shared_command_buffer = nullptr; |
39 gpu::GpuStreamId stream_id = gpu::GpuStreamId::GPU_STREAM_DEFAULT; | 37 gpu::GpuStreamId stream_id = gpu::GpuStreamId::GPU_STREAM_DEFAULT; |
40 gpu::GpuStreamPriority stream_priority = gpu::GpuStreamPriority::NORMAL; | 38 gpu::GpuStreamPriority stream_priority = gpu::GpuStreamPriority::NORMAL; |
41 gpu::gles2::ContextCreationAttribHelper attributes; | 39 gpu::gles2::ContextCreationAttribHelper attributes; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 if (!implementation_->Initialize(default_limits.start_transfer_buffer_size, | 72 if (!implementation_->Initialize(default_limits.start_transfer_buffer_size, |
75 default_limits.min_transfer_buffer_size, | 73 default_limits.min_transfer_buffer_size, |
76 default_limits.max_transfer_buffer_size, | 74 default_limits.max_transfer_buffer_size, |
77 default_limits.mapped_memory_reclaim_limit)) | 75 default_limits.mapped_memory_reclaim_limit)) |
78 return false; | 76 return false; |
79 return true; | 77 return true; |
80 } | 78 } |
81 | 79 |
82 // static | 80 // static |
83 std::unique_ptr<GLES2Context> GLES2Context::CreateOffscreenContext( | 81 std::unique_ptr<GLES2Context> GLES2Context::CreateOffscreenContext( |
84 const std::vector<int32_t>& attribs, | 82 const std::vector<int32_t>& attribs) { |
85 shell::Connector* connector) { | |
86 std::unique_ptr<GLES2Context> gles2_context(new GLES2Context); | 83 std::unique_ptr<GLES2Context> gles2_context(new GLES2Context); |
87 if (!gles2_context->Initialize(attribs, connector)) | 84 if (!gles2_context->Initialize(attribs)) |
88 gles2_context.reset(); | 85 gles2_context.reset(); |
89 return gles2_context; | 86 return gles2_context; |
90 } | 87 } |
91 | 88 |
92 } // namespace ui | 89 } // namespace ui |
OLD | NEW |