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

Side by Side Diff: components/exo/surface.cc

Issue 2485473003: Remove SurfaceFactory::Create and SurfaceFactory::Destroy (Closed)
Patch Set: up Created 4 years 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 "components/exo/surface.h" 5 #include "components/exo/surface.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 237
238 factory_owner_->surface_ = nullptr; 238 factory_owner_->surface_ = nullptr;
239 239
240 // Call pending frame callbacks with a null frame time to indicate that they 240 // Call pending frame callbacks with a null frame time to indicate that they
241 // have been cancelled. 241 // have been cancelled.
242 frame_callbacks_.splice(frame_callbacks_.end(), pending_frame_callbacks_); 242 frame_callbacks_.splice(frame_callbacks_.end(), pending_frame_callbacks_);
243 active_frame_callbacks_.splice(active_frame_callbacks_.end(), 243 active_frame_callbacks_.splice(active_frame_callbacks_.end(),
244 frame_callbacks_); 244 frame_callbacks_);
245 for (const auto& frame_callback : active_frame_callbacks_) 245 for (const auto& frame_callback : active_frame_callbacks_)
246 frame_callback.Run(base::TimeTicks()); 246 frame_callback.Run(base::TimeTicks());
247
248 if (begin_frame_source_ && needs_begin_frame_) 247 if (begin_frame_source_ && needs_begin_frame_)
249 begin_frame_source_->RemoveObserver(this); 248 begin_frame_source_->RemoveObserver(this);
250 249
251 if (local_frame_id_.is_valid()) 250 factory_owner_->surface_factory_->EvictSurface();
252 factory_owner_->surface_factory_->Destroy(local_frame_id_);
253 251
254 surface_manager_->UnregisterSurfaceFactoryClient( 252 surface_manager_->UnregisterSurfaceFactoryClient(
255 factory_owner_->frame_sink_id_); 253 factory_owner_->frame_sink_id_);
256 } 254 }
257 255
258 // static 256 // static
259 Surface* Surface::AsSurface(const aura::Window* window) { 257 Surface* Surface::AsSurface(const aura::Window* window) {
260 return window->GetProperty(kSurfaceKey); 258 return window->GetProperty(kSurfaceKey);
261 } 259 }
262 260
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 470
473 current_buffer_ = std::move(pending_buffer_); 471 current_buffer_ = std::move(pending_buffer_);
474 472
475 UpdateResource(true); 473 UpdateResource(true);
476 } 474 }
477 475
478 cc::LocalFrameId old_local_frame_id = local_frame_id_; 476 cc::LocalFrameId old_local_frame_id = local_frame_id_;
479 if (needs_commit_to_new_surface_ || !local_frame_id_.is_valid()) { 477 if (needs_commit_to_new_surface_ || !local_frame_id_.is_valid()) {
480 needs_commit_to_new_surface_ = false; 478 needs_commit_to_new_surface_ = false;
481 local_frame_id_ = factory_owner_->id_allocator_->GenerateId(); 479 local_frame_id_ = factory_owner_->id_allocator_->GenerateId();
482 factory_owner_->surface_factory_->Create(local_frame_id_);
483 } 480 }
484 481
485 UpdateSurface(true); 482 UpdateSurface(true);
486 483
487 if (old_local_frame_id.is_valid() && old_local_frame_id != local_frame_id_) {
488 factory_owner_->surface_factory_->SetPreviousFrameSurface(
489 local_frame_id_, old_local_frame_id);
490 factory_owner_->surface_factory_->Destroy(old_local_frame_id);
491 }
492
493 if (old_local_frame_id != local_frame_id_) { 484 if (old_local_frame_id != local_frame_id_) {
494 float contents_surface_to_layer_scale = 1.0; 485 float contents_surface_to_layer_scale = 1.0;
495 // The bounds must be updated before switching to the new surface, because 486 // The bounds must be updated before switching to the new surface, because
496 // the layer may be mirrored, in which case a surface change causes the 487 // the layer may be mirrored, in which case a surface change causes the
497 // mirror layer to update its surface using the latest bounds. 488 // mirror layer to update its surface using the latest bounds.
498 window_->layer()->SetBounds( 489 window_->layer()->SetBounds(
499 gfx::Rect(window_->layer()->bounds().origin(), content_size_)); 490 gfx::Rect(window_->layer()->bounds().origin(), content_size_));
500 window_->layer()->SetShowSurface( 491 window_->layer()->SetShowSurface(
501 cc::SurfaceId(factory_owner_->frame_sink_id_, local_frame_id_), 492 cc::SurfaceId(factory_owner_->frame_sink_id_, local_frame_id_),
502 base::Bind(&SatisfyCallback, base::Unretained(surface_manager_)), 493 base::Bind(&SatisfyCallback, base::Unretained(surface_manager_)),
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 873
883 int64_t Surface::GetPropertyInternal(const void* key, 874 int64_t Surface::GetPropertyInternal(const void* key,
884 int64_t default_value) const { 875 int64_t default_value) const {
885 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); 876 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key);
886 if (iter == prop_map_.end()) 877 if (iter == prop_map_.end())
887 return default_value; 878 return default_value;
888 return iter->second.value; 879 return iter->second.value;
889 } 880 }
890 881
891 } // namespace exo 882 } // namespace exo
OLDNEW
« no previous file with comments | « cc/test/test_compositor_frame_sink.cc ('k') | content/browser/frame_host/render_widget_host_view_child_frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698