Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 Loading... | |
| 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 Loading... | |
| 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 |
| OLD | NEW |