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

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

Issue 843883002: [Android] Fix a flicker in stopping Chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 client_(client), 175 client_(client),
176 root_window_(root_window), 176 root_window_(root_window),
177 did_post_swapbuffers_(false), 177 did_post_swapbuffers_(false),
178 ignore_schedule_composite_(false), 178 ignore_schedule_composite_(false),
179 needs_composite_(false), 179 needs_composite_(false),
180 needs_animate_(false), 180 needs_animate_(false),
181 will_composite_immediately_(false), 181 will_composite_immediately_(false),
182 composite_on_vsync_trigger_(DO_NOT_COMPOSITE), 182 composite_on_vsync_trigger_(DO_NOT_COMPOSITE),
183 pending_swapbuffers_(0U), 183 pending_swapbuffers_(0U),
184 defer_composite_for_gpu_channel_(false), 184 defer_composite_for_gpu_channel_(false),
185 paused_(false),
185 weak_factory_(this) { 186 weak_factory_(this) {
186 DCHECK(client); 187 DCHECK(client);
187 DCHECK(root_window); 188 DCHECK(root_window);
188 root_window->AttachCompositor(this); 189 root_window->AttachCompositor(this);
189 } 190 }
190 191
191 CompositorImpl::~CompositorImpl() { 192 CompositorImpl::~CompositorImpl() {
192 root_window_->DetachCompositor(); 193 root_window_->DetachCompositor();
193 // Clean-up any surface references. 194 // Clean-up any surface references.
194 SetSurface(NULL); 195 SetSurface(NULL);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 } 256 }
256 257
257 void CompositorImpl::OnGpuChannelEstablished() { 258 void CompositorImpl::OnGpuChannelEstablished() {
258 defer_composite_for_gpu_channel_ = false; 259 defer_composite_for_gpu_channel_ = false;
259 260
260 if (host_) 261 if (host_)
261 PostComposite(COMPOSITE_IMMEDIATELY); 262 PostComposite(COMPOSITE_IMMEDIATELY);
262 } 263 }
263 264
264 void CompositorImpl::Composite(CompositingTrigger trigger) { 265 void CompositorImpl::Composite(CompositingTrigger trigger) {
266 if (paused_)
David Trainor- moved to gerrit 2015/01/12 18:58:24 Does bypassing this cause side effects? I know so
no sievers 2015/01/12 19:56:49 TLDR: We should either unify our code more with Au
Changwan Ryu 2015/01/13 02:24:55 Thanks for pointing out the conflict, and CopyFrom
267 return;
268
265 if (trigger == COMPOSITE_IMMEDIATELY) 269 if (trigger == COMPOSITE_IMMEDIATELY)
266 will_composite_immediately_ = false; 270 will_composite_immediately_ = false;
267 271
268 BrowserGpuChannelHostFactory* factory = 272 BrowserGpuChannelHostFactory* factory =
269 BrowserGpuChannelHostFactory::instance(); 273 BrowserGpuChannelHostFactory::instance();
270 if (!factory->GetGpuChannel() || factory->GetGpuChannel()->IsLost()) { 274 if (!factory->GetGpuChannel() || factory->GetGpuChannel()->IsLost()) {
271 CauseForGpuLaunch cause = 275 CauseForGpuLaunch cause =
272 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE; 276 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE;
273 factory->EstablishGpuChannel( 277 factory->EstablishGpuChannel(
274 cause, base::Bind(&CompositorImpl::OnGpuChannelEstablished, 278 cause, base::Bind(&CompositorImpl::OnGpuChannelEstablished,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 } 324 }
321 325
322 ui::UIResourceProvider& CompositorImpl::GetUIResourceProvider() { 326 ui::UIResourceProvider& CompositorImpl::GetUIResourceProvider() {
323 return ui_resource_provider_; 327 return ui_resource_provider_;
324 } 328 }
325 329
326 ui::ResourceManager& CompositorImpl::GetResourceManager() { 330 ui::ResourceManager& CompositorImpl::GetResourceManager() {
327 return resource_manager_; 331 return resource_manager_;
328 } 332 }
329 333
334 void CompositorImpl::Pause() {
335 paused_ = true;
336 }
337
338 void CompositorImpl::Resume() {
339 paused_ = false;
340 }
341
330 void CompositorImpl::SetRootLayer(scoped_refptr<cc::Layer> root_layer) { 342 void CompositorImpl::SetRootLayer(scoped_refptr<cc::Layer> root_layer) {
331 if (subroot_layer_.get()) { 343 if (subroot_layer_.get()) {
332 subroot_layer_->RemoveFromParent(); 344 subroot_layer_->RemoveFromParent();
333 subroot_layer_ = NULL; 345 subroot_layer_ = NULL;
334 } 346 }
335 if (root_layer.get()) { 347 if (root_layer.get()) {
336 subroot_layer_ = root_layer; 348 subroot_layer_ = root_layer;
337 root_layer_->AddChild(root_layer); 349 root_layer_->AddChild(root_layer);
338 } 350 }
339 } 351 }
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 707
696 void CompositorImpl::SetNeedsAnimate() { 708 void CompositorImpl::SetNeedsAnimate() {
697 needs_animate_ = true; 709 needs_animate_ = true;
698 if (!host_) 710 if (!host_)
699 return; 711 return;
700 712
701 host_->SetNeedsAnimate(); 713 host_->SetNeedsAnimate();
702 } 714 }
703 715
704 } // namespace content 716 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/compositor_impl_android.h ('k') | content/public/browser/android/compositor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698