Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
| 14 #include "base/trace_event/trace_event_argument.h" | 14 #include "base/trace_event/trace_event_argument.h" |
| 15 #include "cc/quads/render_pass.h" | 15 #include "cc/quads/render_pass.h" |
| 16 #include "cc/quads/shared_quad_state.h" | 16 #include "cc/quads/shared_quad_state.h" |
| 17 #include "cc/quads/solid_color_draw_quad.h" | 17 #include "cc/quads/solid_color_draw_quad.h" |
| 18 #include "cc/quads/texture_draw_quad.h" | 18 #include "cc/quads/texture_draw_quad.h" |
| 19 #include "cc/resources/single_release_callback.h" | 19 #include "cc/resources/single_release_callback.h" |
| 20 #include "cc/surfaces/surface.h" | 20 #include "cc/surfaces/surface.h" |
| 21 #include "cc/surfaces/surface_factory.h" | 21 #include "cc/surfaces/surface_factory.h" |
| 22 #include "cc/surfaces/surface_id_allocator.h" | 22 #include "cc/surfaces/surface_id_allocator.h" |
| 23 #include "cc/surfaces/surface_manager.h" | 23 #include "cc/surfaces/surface_manager.h" |
| 24 #include "components/exo/buffer.h" | 24 #include "components/exo/buffer.h" |
| 25 #include "components/exo/surface_delegate.h" | 25 #include "components/exo/surface_delegate.h" |
| 26 #include "components/exo/surface_observer.h" | 26 #include "components/exo/surface_observer.h" |
| 27 #include "mojo/public/cpp/bindings/strong_binding.h" | |
| 27 #include "third_party/khronos/GLES2/gl2.h" | 28 #include "third_party/khronos/GLES2/gl2.h" |
| 28 #include "ui/aura/env.h" | 29 #include "ui/aura/env.h" |
| 29 #include "ui/aura/window_delegate.h" | 30 #include "ui/aura/window_delegate.h" |
| 30 #include "ui/aura/window_property.h" | 31 #include "ui/aura/window_property.h" |
| 31 #include "ui/aura/window_targeter.h" | 32 #include "ui/aura/window_targeter.h" |
| 32 #include "ui/base/cursor/cursor.h" | 33 #include "ui/base/cursor/cursor.h" |
| 33 #include "ui/base/hit_test.h" | 34 #include "ui/base/hit_test.h" |
| 34 #include "ui/compositor/layer.h" | 35 #include "ui/compositor/layer.h" |
| 35 #include "ui/events/event.h" | 36 #include "ui/events/event.h" |
| 36 #include "ui/gfx/buffer_format_util.h" | 37 #include "ui/gfx/buffer_format_util.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 if (!surface) { | 156 if (!surface) { |
| 156 LOG(ERROR) << "Attempting to require callback on nonexistent surface"; | 157 LOG(ERROR) << "Attempting to require callback on nonexistent surface"; |
| 157 return; | 158 return; |
| 158 } | 159 } |
| 159 surface->AddDestructionDependency(sequence); | 160 surface->AddDestructionDependency(sequence); |
| 160 } | 161 } |
| 161 | 162 |
| 162 } // namespace | 163 } // namespace |
| 163 | 164 |
| 164 //////////////////////////////////////////////////////////////////////////////// | 165 //////////////////////////////////////////////////////////////////////////////// |
| 165 // SurfaceFactoryOwner, public: | |
| 166 | |
| 167 SurfaceFactoryOwner::SurfaceFactoryOwner() {} | |
| 168 | |
| 169 //////////////////////////////////////////////////////////////////////////////// | |
| 170 // cc::SurfaceFactoryClient overrides: | |
| 171 | |
| 172 void SurfaceFactoryOwner::ReturnResources( | |
| 173 const cc::ReturnedResourceArray& resources) { | |
| 174 scoped_refptr<SurfaceFactoryOwner> holder(this); | |
| 175 for (auto& resource : resources) { | |
| 176 auto it = release_callbacks_.find(resource.id); | |
| 177 DCHECK(it != release_callbacks_.end()); | |
| 178 it->second.second->Run(resource.sync_token, resource.lost); | |
| 179 release_callbacks_.erase(it); | |
| 180 } | |
| 181 } | |
| 182 | |
| 183 void SurfaceFactoryOwner::WillDrawSurface(const cc::LocalFrameId& id, | |
| 184 const gfx::Rect& damage_rect) { | |
| 185 if (surface_) | |
| 186 surface_->WillDraw(); | |
| 187 } | |
| 188 | |
| 189 void SurfaceFactoryOwner::SetBeginFrameSource( | |
| 190 cc::BeginFrameSource* begin_frame_source) { | |
| 191 if (surface_) | |
| 192 surface_->SetBeginFrameSource(begin_frame_source); | |
| 193 } | |
| 194 | |
| 195 //////////////////////////////////////////////////////////////////////////////// | |
| 196 // SurfaceFactoryOwner, private: | |
| 197 | |
| 198 SurfaceFactoryOwner::~SurfaceFactoryOwner() { | |
| 199 if (surface_factory_->manager()) | |
| 200 surface_factory_->manager()->InvalidateFrameSinkId(frame_sink_id_); | |
| 201 } | |
| 202 | |
| 203 //////////////////////////////////////////////////////////////////////////////// | |
| 204 // Surface, public: | 166 // Surface, public: |
| 205 | 167 |
| 206 Surface::Surface() | 168 Surface::Surface() |
| 207 : window_(new aura::Window(new CustomWindowDelegate(this))), | 169 : window_(new aura::Window(new CustomWindowDelegate(this))), |
| 208 surface_manager_( | 170 surface_id_( |
| 209 aura::Env::GetInstance()->context_factory()->GetSurfaceManager()), | 171 aura::Env::GetInstance()->context_factory()->AllocateFrameSinkId(), |
| 210 factory_owner_(new SurfaceFactoryOwner) { | 172 cc::LocalFrameId()), |
| 173 compositor_frame_sink_(new ExoCompositorFrameSink( | |
| 174 surface_id_.frame_sink_id(), | |
| 175 aura::Env::GetInstance()->context_factory()->GetSurfaceManager())) { | |
| 211 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); | 176 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); |
| 212 window_->SetName("ExoSurface"); | 177 window_->SetName("ExoSurface"); |
| 213 window_->SetProperty(kSurfaceKey, this); | 178 window_->SetProperty(kSurfaceKey, this); |
| 214 window_->Init(ui::LAYER_SOLID_COLOR); | 179 window_->Init(ui::LAYER_SOLID_COLOR); |
| 215 window_->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter)); | 180 window_->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter)); |
| 216 window_->set_owned_by_parent(false); | 181 window_->set_owned_by_parent(false); |
| 217 window_->AddObserver(this); | 182 window_->AddObserver(this); |
| 218 factory_owner_->surface_ = this; | |
| 219 factory_owner_->frame_sink_id_ = | |
| 220 aura::Env::GetInstance()->context_factory()->AllocateFrameSinkId(); | |
| 221 factory_owner_->id_allocator_.reset(new cc::SurfaceIdAllocator()); | |
| 222 surface_manager_->RegisterFrameSinkId(factory_owner_->frame_sink_id_); | |
| 223 surface_manager_->RegisterSurfaceFactoryClient(factory_owner_->frame_sink_id_, | |
| 224 factory_owner_.get()); | |
| 225 factory_owner_->surface_factory_.reset(new cc::SurfaceFactory( | |
| 226 factory_owner_->frame_sink_id_, surface_manager_, factory_owner_.get())); | |
| 227 aura::Env::GetInstance()->context_factory()->AddObserver(this); | 183 aura::Env::GetInstance()->context_factory()->AddObserver(this); |
| 228 } | 184 } |
| 229 | 185 |
| 230 Surface::~Surface() { | 186 Surface::~Surface() { |
| 231 aura::Env::GetInstance()->context_factory()->RemoveObserver(this); | 187 aura::Env::GetInstance()->context_factory()->RemoveObserver(this); |
| 232 for (SurfaceObserver& observer : observers_) | 188 for (SurfaceObserver& observer : observers_) |
| 233 observer.OnSurfaceDestroying(this); | 189 observer.OnSurfaceDestroying(this); |
| 234 | 190 |
| 235 window_->RemoveObserver(this); | 191 window_->RemoveObserver(this); |
| 236 window_->layer()->SetShowSolidColorContent(); | 192 window_->layer()->SetShowSolidColorContent(); |
| 237 | 193 |
| 238 factory_owner_->surface_ = nullptr; | |
| 239 | |
| 240 // Call pending frame callbacks with a null frame time to indicate that they | 194 // Call pending frame callbacks with a null frame time to indicate that they |
| 241 // have been cancelled. | 195 // have been cancelled. |
| 242 frame_callbacks_.splice(frame_callbacks_.end(), pending_frame_callbacks_); | 196 frame_callbacks_.splice(frame_callbacks_.end(), pending_frame_callbacks_); |
| 243 active_frame_callbacks_.splice(active_frame_callbacks_.end(), | 197 active_frame_callbacks_.splice(active_frame_callbacks_.end(), |
| 244 frame_callbacks_); | 198 frame_callbacks_); |
| 245 for (const auto& frame_callback : active_frame_callbacks_) | 199 for (const auto& frame_callback : active_frame_callbacks_) |
| 246 frame_callback.Run(base::TimeTicks()); | 200 frame_callback.Run(base::TimeTicks()); |
| 247 | 201 |
| 248 if (begin_frame_source_ && needs_begin_frame_) | 202 if (begin_frame_source_ && needs_begin_frame_) |
| 249 begin_frame_source_->RemoveObserver(this); | 203 begin_frame_source_->RemoveObserver(this); |
| 250 | |
| 251 if (local_frame_id_.is_valid()) | |
| 252 factory_owner_->surface_factory_->Destroy(local_frame_id_); | |
| 253 | |
| 254 surface_manager_->UnregisterSurfaceFactoryClient( | |
| 255 factory_owner_->frame_sink_id_); | |
| 256 } | 204 } |
| 257 | 205 |
| 258 // static | 206 // static |
| 259 Surface* Surface::AsSurface(const aura::Window* window) { | 207 Surface* Surface::AsSurface(const aura::Window* window) { |
| 260 return window->GetProperty(kSurfaceKey); | 208 return window->GetProperty(kSurfaceKey); |
| 261 } | 209 } |
| 262 | 210 |
| 263 cc::SurfaceId Surface::GetSurfaceId() const { | 211 cc::SurfaceId Surface::GetSurfaceId() const { |
| 264 return cc::SurfaceId(factory_owner_->frame_sink_id_, local_frame_id_); | 212 return surface_id_; |
|
Fady Samuel
2016/11/16 15:10:58
I think what we might want to do here is *temporar
Alex Z.
2016/11/16 19:56:16
Done.
| |
| 265 } | 213 } |
| 266 | 214 |
| 267 void Surface::Attach(Buffer* buffer) { | 215 void Surface::Attach(Buffer* buffer) { |
| 268 TRACE_EVENT1("exo", "Surface::Attach", "buffer", | 216 TRACE_EVENT1("exo", "Surface::Attach", "buffer", |
| 269 buffer ? buffer->GetSize().ToString() : "null"); | 217 buffer ? buffer->GetSize().ToString() : "null"); |
| 270 | 218 |
| 271 has_pending_contents_ = true; | 219 has_pending_contents_ = true; |
| 272 pending_buffer_.Reset(buffer ? buffer->AsWeakPtr() : base::WeakPtr<Buffer>()); | 220 pending_buffer_.Reset(buffer ? buffer->AsWeakPtr() : base::WeakPtr<Buffer>()); |
| 273 } | 221 } |
| 274 | 222 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 467 | 415 |
| 468 // We update contents if Attach() has been called since last commit. | 416 // We update contents if Attach() has been called since last commit. |
| 469 if (has_pending_contents_) { | 417 if (has_pending_contents_) { |
| 470 has_pending_contents_ = false; | 418 has_pending_contents_ = false; |
| 471 | 419 |
| 472 current_buffer_ = std::move(pending_buffer_); | 420 current_buffer_ = std::move(pending_buffer_); |
| 473 | 421 |
| 474 UpdateResource(true); | 422 UpdateResource(true); |
| 475 } | 423 } |
| 476 | 424 |
| 477 cc::LocalFrameId old_local_frame_id = local_frame_id_; | |
| 478 if (needs_commit_to_new_surface_ || !local_frame_id_.is_valid()) { | |
| 479 needs_commit_to_new_surface_ = false; | |
| 480 local_frame_id_ = factory_owner_->id_allocator_->GenerateId(); | |
| 481 factory_owner_->surface_factory_->Create(local_frame_id_); | |
| 482 } | |
| 483 | |
| 484 UpdateSurface(true); | 425 UpdateSurface(true); |
| 485 | 426 |
| 486 if (old_local_frame_id.is_valid() && old_local_frame_id != local_frame_id_) { | 427 if (needs_commit_to_new_surface_) { |
| 487 factory_owner_->surface_factory_->SetPreviousFrameSurface( | 428 needs_commit_to_new_surface_ = false; |
| 488 local_frame_id_, old_local_frame_id); | |
| 489 factory_owner_->surface_factory_->Destroy(old_local_frame_id); | |
| 490 } | |
| 491 | |
| 492 if (old_local_frame_id != local_frame_id_) { | |
| 493 float contents_surface_to_layer_scale = 1.0; | 429 float contents_surface_to_layer_scale = 1.0; |
| 494 // The bounds must be updated before switching to the new surface, because | 430 // The bounds must be updated before switching to the new surface, because |
| 495 // the layer may be mirrored, in which case a surface change causes the | 431 // the layer may be mirrored, in which case a surface change causes the |
| 496 // mirror layer to update its surface using the latest bounds. | 432 // mirror layer to update its surface using the latest bounds. |
| 497 window_->layer()->SetBounds( | 433 window_->layer()->SetBounds( |
| 498 gfx::Rect(window_->layer()->bounds().origin(), content_size_)); | 434 gfx::Rect(window_->layer()->bounds().origin(), content_size_)); |
| 499 window_->layer()->SetShowSurface( | 435 window_->layer()->SetShowSurface( |
| 500 cc::SurfaceId(factory_owner_->frame_sink_id_, local_frame_id_), | 436 // TODO(staraz): use the new id created in compositor_frame_sink_ |
| 501 base::Bind(&SatisfyCallback, base::Unretained(surface_manager_)), | 437 // instead |
| 502 base::Bind(&RequireCallback, base::Unretained(surface_manager_)), | 438 surface_id_, |
| 439 base::Bind(&SatisfyCallback, | |
| 440 base::Unretained(compositor_frame_sink_->surface_manager())), | |
| 441 base::Bind(&RequireCallback, | |
| 442 base::Unretained(compositor_frame_sink_->surface_manager())), | |
| 503 content_size_, contents_surface_to_layer_scale, content_size_); | 443 content_size_, contents_surface_to_layer_scale, content_size_); |
| 504 window_->layer()->SetFillsBoundsOpaquely( | 444 window_->layer()->SetFillsBoundsOpaquely( |
| 505 state_.blend_mode == SkXfermode::kSrc_Mode || | 445 state_.blend_mode == SkXfermode::kSrc_Mode || |
| 506 state_.opaque_region.contains( | 446 state_.opaque_region.contains( |
| 507 gfx::RectToSkIRect(gfx::Rect(content_size_)))); | 447 gfx::RectToSkIRect(gfx::Rect(content_size_)))); |
| 508 } | 448 } |
| 509 | 449 |
| 510 // Reset damage. | 450 // Reset damage. |
| 511 pending_damage_.setEmpty(); | 451 pending_damage_.setEmpty(); |
| 512 | 452 |
| 513 DCHECK(!current_resource_.id || | 453 DCHECK( |
| 514 factory_owner_->release_callbacks_.count(current_resource_.id)); | 454 !current_resource_.id || |
| 455 compositor_frame_sink_->release_callbacks_.count(current_resource_.id)); | |
| 515 | 456 |
| 516 // Move pending frame callbacks to the end of frame_callbacks_. | 457 // Move pending frame callbacks to the end of frame_callbacks_. |
| 517 frame_callbacks_.splice(frame_callbacks_.end(), pending_frame_callbacks_); | 458 frame_callbacks_.splice(frame_callbacks_.end(), pending_frame_callbacks_); |
| 518 | 459 |
| 519 // Synchronize window hierarchy. This will position and update the stacking | 460 // Synchronize window hierarchy. This will position and update the stacking |
| 520 // order of all sub-surfaces after committing all pending state of sub-surface | 461 // order of all sub-surfaces after committing all pending state of sub-surface |
| 521 // descendants. | 462 // descendants. |
| 522 aura::Window* stacking_target = nullptr; | 463 aura::Window* stacking_target = nullptr; |
| 523 for (auto& sub_surface_entry : pending_sub_surfaces_) { | 464 for (auto& sub_surface_entry : pending_sub_surfaces_) { |
| 524 Surface* sub_surface = sub_surface_entry.first; | 465 Surface* sub_surface = sub_surface_entry.first; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 629 begin_frame_source_ = begin_frame_source; | 570 begin_frame_source_ = begin_frame_source; |
| 630 UpdateNeedsBeginFrame(); | 571 UpdateNeedsBeginFrame(); |
| 631 } | 572 } |
| 632 | 573 |
| 633 void Surface::CheckIfSurfaceHierarchyNeedsCommitToNewSurfaces() { | 574 void Surface::CheckIfSurfaceHierarchyNeedsCommitToNewSurfaces() { |
| 634 if (HasLayerHierarchyChanged()) | 575 if (HasLayerHierarchyChanged()) |
| 635 SetSurfaceHierarchyNeedsCommitToNewSurfaces(); | 576 SetSurfaceHierarchyNeedsCommitToNewSurfaces(); |
| 636 } | 577 } |
| 637 | 578 |
| 638 void Surface::OnLostResources() { | 579 void Surface::OnLostResources() { |
| 639 if (!local_frame_id_.is_valid()) | 580 if (!surface_id_.is_valid()) |
| 640 return; | 581 return; |
| 641 | 582 |
| 642 UpdateResource(false); | 583 UpdateResource(false); |
| 643 UpdateSurface(false); | 584 UpdateSurface(false); |
| 644 } | 585 } |
| 645 | 586 |
| 646 void Surface::OnWindowAddedToRootWindow(aura::Window* window) { | 587 void Surface::OnWindowAddedToRootWindow(aura::Window* window) { |
| 647 window->layer()->GetCompositor()->AddFrameSink( | 588 window->layer()->GetCompositor()->AddFrameSink( |
| 648 factory_owner_->frame_sink_id_); | 589 compositor_frame_sink_->frame_sink_id_); |
|
Fady Samuel
2016/11/16 15:10:58
The exo::Surface should have a fixed frame_sink_id
Alex Z.
2016/11/16 19:56:16
Done.
| |
| 649 } | 590 } |
| 650 | 591 |
| 651 void Surface::OnWindowRemovingFromRootWindow(aura::Window* window, | 592 void Surface::OnWindowRemovingFromRootWindow(aura::Window* window, |
| 652 aura::Window* new_root) { | 593 aura::Window* new_root) { |
| 653 window->layer()->GetCompositor()->RemoveFrameSink( | 594 window->layer()->GetCompositor()->RemoveFrameSink( |
| 654 factory_owner_->frame_sink_id_); | 595 compositor_frame_sink_->frame_sink_id_); |
|
Fady Samuel
2016/11/16 15:10:58
The exo::Surface should have a fixed frame_sink_id
Alex Z.
2016/11/16 19:56:16
Done.
| |
| 655 } | 596 } |
| 656 | 597 |
| 657 void Surface::OnBeginFrame(const cc::BeginFrameArgs& args) { | 598 void Surface::OnBeginFrame(const cc::BeginFrameArgs& args) { |
| 658 while (!active_frame_callbacks_.empty()) { | 599 while (!active_frame_callbacks_.empty()) { |
| 659 active_frame_callbacks_.front().Run(args.frame_time); | 600 active_frame_callbacks_.front().Run(args.frame_time); |
| 660 active_frame_callbacks_.pop_front(); | 601 active_frame_callbacks_.pop_front(); |
| 661 } | 602 } |
| 662 last_begin_frame_args_ = args; | 603 last_begin_frame_args_ = args; |
| 663 } | 604 } |
| 664 | 605 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 733 | 674 |
| 734 cc::TextureMailbox texture_mailbox; | 675 cc::TextureMailbox texture_mailbox; |
| 735 if (current_buffer_.buffer()) { | 676 if (current_buffer_.buffer()) { |
| 736 texture_mailbox_release_callback = | 677 texture_mailbox_release_callback = |
| 737 current_buffer_.buffer()->ProduceTextureMailbox( | 678 current_buffer_.buffer()->ProduceTextureMailbox( |
| 738 &texture_mailbox, state_.only_visible_on_secure_output, | 679 &texture_mailbox, state_.only_visible_on_secure_output, |
| 739 client_usage); | 680 client_usage); |
| 740 } | 681 } |
| 741 | 682 |
| 742 if (texture_mailbox_release_callback) { | 683 if (texture_mailbox_release_callback) { |
| 743 cc::TransferableResource resource; | 684 cc::TransferableResource resource; |
|
Fady Samuel
2016/11/16 15:10:58
I *think* what should happen is these resources sh
| |
| 744 resource.id = next_resource_id_++; | 685 resource.id = next_resource_id_++; |
| 745 resource.format = cc::RGBA_8888; | 686 resource.format = cc::RGBA_8888; |
| 746 resource.filter = | 687 resource.filter = |
| 747 texture_mailbox.nearest_neighbor() ? GL_NEAREST : GL_LINEAR; | 688 texture_mailbox.nearest_neighbor() ? GL_NEAREST : GL_LINEAR; |
| 748 resource.size = texture_mailbox.size_in_pixels(); | 689 resource.size = texture_mailbox.size_in_pixels(); |
| 749 resource.mailbox_holder = gpu::MailboxHolder(texture_mailbox.mailbox(), | 690 resource.mailbox_holder = gpu::MailboxHolder(texture_mailbox.mailbox(), |
| 750 texture_mailbox.sync_token(), | 691 texture_mailbox.sync_token(), |
| 751 texture_mailbox.target()); | 692 texture_mailbox.target()); |
| 752 resource.is_overlay_candidate = texture_mailbox.is_overlay_candidate(); | 693 resource.is_overlay_candidate = texture_mailbox.is_overlay_candidate(); |
| 753 | 694 |
| 754 factory_owner_->release_callbacks_[resource.id] = std::make_pair( | 695 compositor_frame_sink_->release_callbacks_[resource.id] = std::make_pair( |
| 755 factory_owner_, std::move(texture_mailbox_release_callback)); | 696 compositor_frame_sink_, std::move(texture_mailbox_release_callback)); |
| 756 current_resource_ = resource; | 697 current_resource_ = resource; |
| 757 } else { | 698 } else { |
| 758 current_resource_.id = 0; | 699 current_resource_.id = 0; |
| 759 current_resource_.size = gfx::Size(); | 700 current_resource_.size = gfx::Size(); |
| 760 } | 701 } |
| 761 } | 702 } |
| 762 | 703 |
| 763 void Surface::UpdateSurface(bool full_damage) { | 704 void Surface::UpdateSurface(bool full_damage) { |
| 764 gfx::Size buffer_size = current_resource_.size; | 705 gfx::Size buffer_size = current_resource_.size; |
| 765 gfx::SizeF scaled_buffer_size( | 706 gfx::SizeF scaled_buffer_size( |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 838 } else { | 779 } else { |
| 839 cc::SolidColorDrawQuad* solid_quad = | 780 cc::SolidColorDrawQuad* solid_quad = |
| 840 render_pass->CreateAndAppendDrawQuad<cc::SolidColorDrawQuad>(); | 781 render_pass->CreateAndAppendDrawQuad<cc::SolidColorDrawQuad>(); |
| 841 solid_quad->SetNew(quad_state, quad_rect, quad_rect, SK_ColorBLACK, false); | 782 solid_quad->SetNew(quad_state, quad_rect, quad_rect, SK_ColorBLACK, false); |
| 842 } | 783 } |
| 843 | 784 |
| 844 delegated_frame->render_pass_list.push_back(std::move(render_pass)); | 785 delegated_frame->render_pass_list.push_back(std::move(render_pass)); |
| 845 cc::CompositorFrame frame; | 786 cc::CompositorFrame frame; |
| 846 frame.delegated_frame_data = std::move(delegated_frame); | 787 frame.delegated_frame_data = std::move(delegated_frame); |
| 847 | 788 |
| 848 factory_owner_->surface_factory_->SubmitCompositorFrame( | 789 compositor_frame_sink_->SubmitCompositorFrame(std::move(frame)); |
| 849 local_frame_id_, std::move(frame), cc::SurfaceFactory::DrawCallback()); | |
| 850 } | 790 } |
| 851 | 791 |
| 852 void Surface::UpdateNeedsBeginFrame() { | 792 void Surface::UpdateNeedsBeginFrame() { |
| 853 if (!begin_frame_source_) | 793 if (!begin_frame_source_) |
| 854 return; | 794 return; |
| 855 | 795 |
| 856 bool needs_begin_frame = !active_frame_callbacks_.empty(); | 796 bool needs_begin_frame = !active_frame_callbacks_.empty(); |
| 857 if (needs_begin_frame == needs_begin_frame_) | 797 if (needs_begin_frame == needs_begin_frame_) |
| 858 return; | 798 return; |
| 859 | 799 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 884 | 824 |
| 885 int64_t Surface::GetPropertyInternal(const void* key, | 825 int64_t Surface::GetPropertyInternal(const void* key, |
| 886 int64_t default_value) const { | 826 int64_t default_value) const { |
| 887 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); | 827 std::map<const void*, Value>::const_iterator iter = prop_map_.find(key); |
| 888 if (iter == prop_map_.end()) | 828 if (iter == prop_map_.end()) |
| 889 return default_value; | 829 return default_value; |
| 890 return iter->second.value; | 830 return iter->second.value; |
| 891 } | 831 } |
| 892 | 832 |
| 893 } // namespace exo | 833 } // namespace exo |
| OLD | NEW |