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

Side by Side Diff: ui/aura/mus/mus_context_factory.cc

Issue 2895273002: Unified the use of BufferToTextureTargetMap for all the Processes (Closed)
Patch Set: nit taken care Created 3 years, 5 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ui/aura/mus/mus_context_factory.h" 5 #include "ui/aura/mus/mus_context_factory.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "cc/base/switches.h" 9 #include "cc/base/switches.h"
10 #include "services/ui/public/cpp/gpu/gpu.h" 10 #include "services/ui/public/cpp/gpu/gpu.h"
11 #include "ui/aura/mus/window_port_mus.h" 11 #include "ui/aura/mus/window_port_mus.h"
12 #include "ui/aura/window_tree_host.h" 12 #include "ui/aura/window_tree_host.h"
13 #include "ui/compositor/compositor_switches.h" 13 #include "ui/compositor/compositor_switches.h"
14 #include "ui/compositor/compositor_util.h" 14 #include "ui/compositor/compositor_util.h"
15 #include "ui/display/display_switches.h" 15 #include "ui/display/display_switches.h"
16 #include "ui/gfx/switches.h" 16 #include "ui/gfx/switches.h"
17 #include "ui/gl/gl_bindings.h" 17 #include "ui/gl/gl_bindings.h"
18 18
19 namespace aura { 19 namespace aura {
20 20
21 namespace {
22 cc::BufferToTextureTargetMap CreateBufferToTextureTargetMap() {
23 cc::BufferToTextureTargetMap image_targets;
24 for (int usage_idx = 0; usage_idx <= static_cast<int>(gfx::BufferUsage::LAST);
25 ++usage_idx) {
26 gfx::BufferUsage usage = static_cast<gfx::BufferUsage>(usage_idx);
27 for (int format_idx = 0;
28 format_idx <= static_cast<int>(gfx::BufferFormat::LAST);
29 ++format_idx) {
30 gfx::BufferFormat format = static_cast<gfx::BufferFormat>(format_idx);
31 // TODO(sad): http://crbug.com/675431
32 image_targets[std::make_pair(usage, format)] = GL_TEXTURE_2D;
33 }
34 }
35 return image_targets;
36 }
37 } // namespace
38
21 MusContextFactory::MusContextFactory(ui::Gpu* gpu) 39 MusContextFactory::MusContextFactory(ui::Gpu* gpu)
22 : gpu_(gpu), 40 : gpu_(gpu),
23 renderer_settings_(ui::CreateRendererSettings( 41 renderer_settings_(
24 [](gfx::BufferFormat format, gfx::BufferUsage usage) -> uint32_t { 42 ui::CreateRendererSettings(CreateBufferToTextureTargetMap())),
25 // TODO(sad): http://crbug.com/675431
26 return GL_TEXTURE_2D;
27 })),
28 weak_ptr_factory_(this) {} 43 weak_ptr_factory_(this) {}
29 44
30 MusContextFactory::~MusContextFactory() {} 45 MusContextFactory::~MusContextFactory() {}
31 46
32 void MusContextFactory::OnEstablishedGpuChannel( 47 void MusContextFactory::OnEstablishedGpuChannel(
33 base::WeakPtr<ui::Compositor> compositor, 48 base::WeakPtr<ui::Compositor> compositor,
34 scoped_refptr<gpu::GpuChannelHost> gpu_channel) { 49 scoped_refptr<gpu::GpuChannelHost> gpu_channel) {
35 if (!compositor) 50 if (!compositor)
36 return; 51 return;
37 WindowTreeHost* host = 52 WindowTreeHost* host =
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 94
80 cc::TaskGraphRunner* MusContextFactory::GetTaskGraphRunner() { 95 cc::TaskGraphRunner* MusContextFactory::GetTaskGraphRunner() {
81 return raster_thread_helper_.task_graph_runner(); 96 return raster_thread_helper_.task_graph_runner();
82 } 97 }
83 98
84 const cc::ResourceSettings& MusContextFactory::GetResourceSettings() const { 99 const cc::ResourceSettings& MusContextFactory::GetResourceSettings() const {
85 return renderer_settings_.resource_settings; 100 return renderer_settings_.resource_settings;
86 } 101 }
87 102
88 } // namespace aura 103 } // namespace aura
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | ui/compositor/compositor_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698