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

Side by Side Diff: content/browser/renderer_host/compositor_impl_android.cc

Issue 1122393003: CC: Plumb LayerSettings parameter for cc::Layer construction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/compositor_impl_android.h" 5 #include "content/browser/renderer_host/compositor_impl_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 #include <android/native_window_jni.h> 8 #include <android/native_window_jni.h>
9 9
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
(...skipping 18 matching lines...) Expand all
29 #include "cc/output/context_provider.h" 29 #include "cc/output/context_provider.h"
30 #include "cc/output/output_surface.h" 30 #include "cc/output/output_surface.h"
31 #include "cc/output/output_surface_client.h" 31 #include "cc/output/output_surface_client.h"
32 #include "cc/raster/task_graph_runner.h" 32 #include "cc/raster/task_graph_runner.h"
33 #include "cc/scheduler/begin_frame_source.h" 33 #include "cc/scheduler/begin_frame_source.h"
34 #include "cc/surfaces/onscreen_display_client.h" 34 #include "cc/surfaces/onscreen_display_client.h"
35 #include "cc/surfaces/surface_display_output_surface.h" 35 #include "cc/surfaces/surface_display_output_surface.h"
36 #include "cc/surfaces/surface_id_allocator.h" 36 #include "cc/surfaces/surface_id_allocator.h"
37 #include "cc/surfaces/surface_manager.h" 37 #include "cc/surfaces/surface_manager.h"
38 #include "cc/trees/layer_tree_host.h" 38 #include "cc/trees/layer_tree_host.h"
39 #include "cc/trees/layer_tree_settings.h"
39 #include "content/browser/android/child_process_launcher_android.h" 40 #include "content/browser/android/child_process_launcher_android.h"
40 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" 41 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
41 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" 42 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
42 #include "content/browser/gpu/compositor_util.h" 43 #include "content/browser/gpu/compositor_util.h"
43 #include "content/browser/gpu/gpu_surface_tracker.h" 44 #include "content/browser/gpu/gpu_surface_tracker.h"
44 #include "content/browser/renderer_host/render_widget_host_impl.h" 45 #include "content/browser/renderer_host/render_widget_host_impl.h"
45 #include "content/common/gpu/client/command_buffer_proxy_impl.h" 46 #include "content/common/gpu/client/command_buffer_proxy_impl.h"
46 #include "content/common/gpu/client/context_provider_command_buffer.h" 47 #include "content/common/gpu/client/context_provider_command_buffer.h"
47 #include "content/common/gpu/client/gl_helper.h" 48 #include "content/common/gpu/client/gl_helper.h"
48 #include "content/common/gpu/client/gpu_channel_host.h" 49 #include "content/common/gpu/client/gpu_channel_host.h"
49 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 50 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
50 #include "content/common/gpu/gpu_process_launch_causes.h" 51 #include "content/common/gpu/gpu_process_launch_causes.h"
51 #include "content/common/host_shared_bitmap_manager.h" 52 #include "content/common/host_shared_bitmap_manager.h"
53 #include "content/public/browser/android/compositor.h"
52 #include "content/public/browser/android/compositor_client.h" 54 #include "content/public/browser/android/compositor_client.h"
53 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" 55 #include "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h"
54 #include "gpu/command_buffer/client/context_support.h" 56 #include "gpu/command_buffer/client/context_support.h"
55 #include "gpu/command_buffer/client/gles2_interface.h" 57 #include "gpu/command_buffer/client/gles2_interface.h"
56 #include "third_party/khronos/GLES2/gl2.h" 58 #include "third_party/khronos/GLES2/gl2.h"
57 #include "third_party/khronos/GLES2/gl2ext.h" 59 #include "third_party/khronos/GLES2/gl2ext.h"
58 #include "third_party/skia/include/core/SkMallocPixelRef.h" 60 #include "third_party/skia/include/core/SkMallocPixelRef.h"
59 #include "ui/android/window_android.h" 61 #include "ui/android/window_android.h"
60 #include "ui/gfx/android/device_display_info.h" 62 #include "ui/gfx/android/device_display_info.h"
61 #include "ui/gfx/frame_time.h" 63 #include "ui/gfx/frame_time.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 private: 159 private:
158 // Overridden from base::DelegateSimpleThread::Delegate: 160 // Overridden from base::DelegateSimpleThread::Delegate:
159 void Run() override { cc::TaskGraphRunner::Run(); } 161 void Run() override { cc::TaskGraphRunner::Run(); }
160 162
161 base::DelegateSimpleThread worker_thread_; 163 base::DelegateSimpleThread worker_thread_;
162 }; 164 };
163 165
164 base::LazyInstance<SingleThreadTaskGraphRunner> g_task_graph_runner = 166 base::LazyInstance<SingleThreadTaskGraphRunner> g_task_graph_runner =
165 LAZY_INSTANCE_INITIALIZER; 167 LAZY_INSTANCE_INITIALIZER;
166 168
169 base::LazyInstance<cc::LayerSettings> g_layer_settings =
170 LAZY_INSTANCE_INITIALIZER;
171
167 } // anonymous namespace 172 } // anonymous namespace
168 173
169 // static 174 // static
170 Compositor* Compositor::Create(CompositorClient* client, 175 Compositor* Compositor::Create(CompositorClient* client,
171 gfx::NativeWindow root_window) { 176 gfx::NativeWindow root_window) {
172 return client ? new CompositorImpl(client, root_window) : NULL; 177 return client ? new CompositorImpl(client, root_window) : NULL;
173 } 178 }
174 179
175 // static 180 // static
176 void Compositor::Initialize() { 181 void Compositor::Initialize() {
177 DCHECK(!CompositorImpl::IsInitialized()); 182 DCHECK(!CompositorImpl::IsInitialized());
178 g_initialized = true; 183 g_initialized = true;
179 g_use_surface_manager = UseSurfacesEnabled(); 184 g_use_surface_manager = UseSurfacesEnabled();
180 } 185 }
181 186
182 // static 187 // static
188 const cc::LayerSettings& Compositor::LayerSettings() {
189 return g_layer_settings.Get();
190 }
191
192 // static
193 void Compositor::SetLayerSettings(const cc::LayerSettings& settings) {
194 g_layer_settings.Get() = settings;
195 }
196
197 // static
183 bool CompositorImpl::IsInitialized() { 198 bool CompositorImpl::IsInitialized() {
184 return g_initialized; 199 return g_initialized;
185 } 200 }
186 201
187 // static 202 // static
188 cc::SurfaceManager* CompositorImpl::GetSurfaceManager() { 203 cc::SurfaceManager* CompositorImpl::GetSurfaceManager() {
189 if (!g_use_surface_manager) 204 if (!g_use_surface_manager)
190 return nullptr; 205 return nullptr;
191 return g_surface_manager.Pointer(); 206 return g_surface_manager.Pointer();
192 } 207 }
193 208
194 // static 209 // static
195 scoped_ptr<cc::SurfaceIdAllocator> CompositorImpl::CreateSurfaceIdAllocator() { 210 scoped_ptr<cc::SurfaceIdAllocator> CompositorImpl::CreateSurfaceIdAllocator() {
196 return make_scoped_ptr(new cc::SurfaceIdAllocator(++g_surface_id_namespace)); 211 return make_scoped_ptr(new cc::SurfaceIdAllocator(++g_surface_id_namespace));
197 } 212 }
198 213
199 CompositorImpl::CompositorImpl(CompositorClient* client, 214 CompositorImpl::CompositorImpl(CompositorClient* client,
200 gfx::NativeWindow root_window) 215 gfx::NativeWindow root_window)
201 : root_layer_(cc::Layer::Create()), 216 : root_layer_(cc::Layer::Create(Compositor::LayerSettings())),
202 resource_manager_(&ui_resource_provider_), 217 resource_manager_(&ui_resource_provider_),
203 surface_id_allocator_(CreateSurfaceIdAllocator()), 218 surface_id_allocator_(CreateSurfaceIdAllocator()),
204 has_transparent_background_(false), 219 has_transparent_background_(false),
205 device_scale_factor_(1), 220 device_scale_factor_(1),
206 window_(NULL), 221 window_(NULL),
207 surface_id_(0), 222 surface_id_(0),
208 client_(client), 223 client_(client),
209 root_window_(root_window), 224 root_window_(root_window),
210 did_post_swapbuffers_(false), 225 did_post_swapbuffers_(false),
211 ignore_schedule_composite_(false), 226 ignore_schedule_composite_(false),
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 749
735 void CompositorImpl::SetNeedsAnimate() { 750 void CompositorImpl::SetNeedsAnimate() {
736 needs_animate_ = true; 751 needs_animate_ = true;
737 if (!host_) 752 if (!host_)
738 return; 753 return;
739 754
740 host_->SetNeedsAnimate(); 755 host_->SetNeedsAnimate();
741 } 756 }
742 757
743 } // namespace content 758 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698