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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
162 needs_composite_(false), | 162 needs_composite_(false), |
163 needs_animate_(false), | 163 needs_animate_(false), |
164 will_composite_immediately_(false), | 164 will_composite_immediately_(false), |
165 composite_on_vsync_trigger_(DO_NOT_COMPOSITE), | 165 composite_on_vsync_trigger_(DO_NOT_COMPOSITE), |
166 pending_swapbuffers_(0U), | 166 pending_swapbuffers_(0U), |
167 weak_factory_(this) { | 167 weak_factory_(this) { |
168 DCHECK(client); | 168 DCHECK(client); |
169 DCHECK(root_window); | 169 DCHECK(root_window); |
170 ImageTransportFactoryAndroid::AddObserver(this); | 170 ImageTransportFactoryAndroid::AddObserver(this); |
171 root_window->AttachCompositor(this); | 171 root_window->AttachCompositor(this); |
172 resource_manager_.reset( | |
173 new content::ResourceManagerImpl(&ui_resource_provider_)); | |
172 } | 174 } |
173 | 175 |
174 CompositorImpl::~CompositorImpl() { | 176 CompositorImpl::~CompositorImpl() { |
177 resource_manager_.reset(NULL); | |
David Trainor- moved to gerrit
2014/11/18 18:53:53
nullptr?
Jaekyun Seok (inactive)
2014/11/18 23:34:02
Done.
| |
175 root_window_->DetachCompositor(); | 178 root_window_->DetachCompositor(); |
176 ImageTransportFactoryAndroid::RemoveObserver(this); | 179 ImageTransportFactoryAndroid::RemoveObserver(this); |
177 // Clean-up any surface references. | 180 // Clean-up any surface references. |
178 SetSurface(NULL); | 181 SetSurface(NULL); |
179 } | 182 } |
180 | 183 |
181 void CompositorImpl::PostComposite(CompositingTrigger trigger) { | 184 void CompositorImpl::PostComposite(CompositingTrigger trigger) { |
182 DCHECK(needs_composite_); | 185 DCHECK(needs_composite_); |
183 DCHECK(trigger == COMPOSITE_IMMEDIATELY || trigger == COMPOSITE_EVENTUALLY); | 186 DCHECK(trigger == COMPOSITE_IMMEDIATELY || trigger == COMPOSITE_EVENTUALLY); |
184 | 187 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
290 pending_swapbuffers_++; | 293 pending_swapbuffers_++; |
291 | 294 |
292 // Need to track vsync to avoid compositing more than once per frame. | 295 // Need to track vsync to avoid compositing more than once per frame. |
293 root_window_->RequestVSyncUpdate(); | 296 root_window_->RequestVSyncUpdate(); |
294 } | 297 } |
295 | 298 |
296 UIResourceProvider& CompositorImpl::GetUIResourceProvider() { | 299 UIResourceProvider& CompositorImpl::GetUIResourceProvider() { |
297 return ui_resource_provider_; | 300 return ui_resource_provider_; |
298 } | 301 } |
299 | 302 |
303 ResourceManager* CompositorImpl::GetResourceManager() { | |
304 return resource_manager_.get(); | |
305 } | |
306 | |
300 ui::SystemUIResourceManager& CompositorImpl::GetSystemUIResourceManager() { | 307 ui::SystemUIResourceManager& CompositorImpl::GetSystemUIResourceManager() { |
301 return ui_resource_provider_.GetSystemUIResourceManager(); | 308 return ui_resource_provider_.GetSystemUIResourceManager(); |
302 } | 309 } |
303 | 310 |
304 void CompositorImpl::SetRootLayer(scoped_refptr<cc::Layer> root_layer) { | 311 void CompositorImpl::SetRootLayer(scoped_refptr<cc::Layer> root_layer) { |
305 if (subroot_layer_.get()) { | 312 if (subroot_layer_.get()) { |
306 subroot_layer_->RemoveFromParent(); | 313 subroot_layer_->RemoveFromParent(); |
307 subroot_layer_ = NULL; | 314 subroot_layer_ = NULL; |
308 } | 315 } |
309 if (root_layer.get()) { | 316 if (root_layer.get()) { |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
631 } | 638 } |
632 | 639 |
633 void CompositorImpl::SetNeedsAnimate() { | 640 void CompositorImpl::SetNeedsAnimate() { |
634 if (!host_) | 641 if (!host_) |
635 return; | 642 return; |
636 | 643 |
637 host_->SetNeedsAnimate(); | 644 host_->SetNeedsAnimate(); |
638 } | 645 } |
639 | 646 |
640 } // namespace content | 647 } // namespace content |
OLD | NEW |