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

Side by Side Diff: content/browser/frame_host/render_widget_host_view_child_frame.cc

Issue 2661543002: Rename LocalFrameId to LocalSurfaceId (Closed)
Patch Set: c Created 3 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/frame_host/render_widget_host_view_child_frame.h" 5 #include "content/browser/frame_host/render_widget_host_view_child_frame.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 void RenderWidgetHostViewChildFrame::Focus() { 141 void RenderWidgetHostViewChildFrame::Focus() {
142 } 142 }
143 143
144 bool RenderWidgetHostViewChildFrame::HasFocus() const { 144 bool RenderWidgetHostViewChildFrame::HasFocus() const {
145 if (frame_connector_) 145 if (frame_connector_)
146 return frame_connector_->HasFocus(); 146 return frame_connector_->HasFocus();
147 return false; 147 return false;
148 } 148 }
149 149
150 bool RenderWidgetHostViewChildFrame::IsSurfaceAvailableForCopy() const { 150 bool RenderWidgetHostViewChildFrame::IsSurfaceAvailableForCopy() const {
151 return local_frame_id_.is_valid(); 151 return local_surface_id_.is_valid();
152 } 152 }
153 153
154 void RenderWidgetHostViewChildFrame::Show() { 154 void RenderWidgetHostViewChildFrame::Show() {
155 if (!host_->is_hidden()) 155 if (!host_->is_hidden())
156 return; 156 return;
157 host_->WasShown(ui::LatencyInfo()); 157 host_->WasShown(ui::LatencyInfo());
158 } 158 }
159 159
160 void RenderWidgetHostViewChildFrame::Hide() { 160 void RenderWidgetHostViewChildFrame::Hide() {
161 if (host_->is_hidden()) 161 if (host_->is_hidden())
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 ClearCompositorSurfaceIfNecessary(); 391 ClearCompositorSurfaceIfNecessary();
392 // If the renderer changed its frame sink, reset the surface factory to 392 // If the renderer changed its frame sink, reset the surface factory to
393 // avoid returning stale resources. 393 // avoid returning stale resources.
394 if (compositor_frame_sink_id != last_compositor_frame_sink_id_) 394 if (compositor_frame_sink_id != last_compositor_frame_sink_id_)
395 surface_factory_->Reset(); 395 surface_factory_->Reset();
396 last_compositor_frame_sink_id_ = compositor_frame_sink_id; 396 last_compositor_frame_sink_id_ = compositor_frame_sink_id;
397 current_surface_size_ = frame.render_pass_list.back()->output_rect.size(); 397 current_surface_size_ = frame.render_pass_list.back()->output_rect.size();
398 current_surface_scale_factor_ = frame.metadata.device_scale_factor; 398 current_surface_scale_factor_ = frame.metadata.device_scale_factor;
399 } 399 }
400 400
401 bool allocated_new_local_frame_id = false; 401 bool allocated_new_local_surface_id = false;
402 if (!local_frame_id_.is_valid()) { 402 if (!local_surface_id_.is_valid()) {
403 local_frame_id_ = id_allocator_->GenerateId(); 403 local_surface_id_ = id_allocator_->GenerateId();
404 allocated_new_local_frame_id = true; 404 allocated_new_local_surface_id = true;
405 } 405 }
406 406
407 cc::SurfaceFactory::DrawCallback ack_callback = 407 cc::SurfaceFactory::DrawCallback ack_callback =
408 base::Bind(&RenderWidgetHostViewChildFrame::SurfaceDrawn, AsWeakPtr(), 408 base::Bind(&RenderWidgetHostViewChildFrame::SurfaceDrawn, AsWeakPtr(),
409 compositor_frame_sink_id); 409 compositor_frame_sink_id);
410 ack_pending_count_++; 410 ack_pending_count_++;
411 // If this value grows very large, something is going wrong. 411 // If this value grows very large, something is going wrong.
412 DCHECK_LT(ack_pending_count_, 1000U); 412 DCHECK_LT(ack_pending_count_, 1000U);
413 surface_factory_->SubmitCompositorFrame(local_frame_id_, std::move(frame), 413 surface_factory_->SubmitCompositorFrame(local_surface_id_, std::move(frame),
414 ack_callback); 414 ack_callback);
415 if (allocated_new_local_frame_id) 415 if (allocated_new_local_surface_id)
416 SendSurfaceInfoToEmbedder(); 416 SendSurfaceInfoToEmbedder();
417 ProcessFrameSwappedCallbacks(); 417 ProcessFrameSwappedCallbacks();
418 } 418 }
419 419
420 void RenderWidgetHostViewChildFrame::SendSurfaceInfoToEmbedder() { 420 void RenderWidgetHostViewChildFrame::SendSurfaceInfoToEmbedder() {
421 cc::SurfaceSequence sequence = 421 cc::SurfaceSequence sequence =
422 cc::SurfaceSequence(frame_sink_id_, next_surface_sequence_++); 422 cc::SurfaceSequence(frame_sink_id_, next_surface_sequence_++);
423 cc::SurfaceManager* manager = GetSurfaceManager(); 423 cc::SurfaceManager* manager = GetSurfaceManager();
424 cc::SurfaceId surface_id(frame_sink_id_, local_frame_id_); 424 cc::SurfaceId surface_id(frame_sink_id_, local_surface_id_);
425 // The renderer process will satisfy this dependency when it creates a 425 // The renderer process will satisfy this dependency when it creates a
426 // SurfaceLayer. 426 // SurfaceLayer.
427 manager->GetSurfaceForId(surface_id)->AddDestructionDependency(sequence); 427 manager->GetSurfaceForId(surface_id)->AddDestructionDependency(sequence);
428 cc::SurfaceInfo surface_info(surface_id, current_surface_scale_factor_, 428 cc::SurfaceInfo surface_info(surface_id, current_surface_scale_factor_,
429 current_surface_size_); 429 current_surface_size_);
430 SendSurfaceInfoToEmbedderImpl(surface_info, sequence); 430 SendSurfaceInfoToEmbedderImpl(surface_info, sequence);
431 } 431 }
432 432
433 void RenderWidgetHostViewChildFrame::SendSurfaceInfoToEmbedderImpl( 433 void RenderWidgetHostViewChildFrame::SendSurfaceInfoToEmbedderImpl(
434 const cc::SurfaceInfo& surface_info, 434 const cc::SurfaceInfo& surface_info,
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 } 531 }
532 532
533 void RenderWidgetHostViewChildFrame::ProcessGestureEvent( 533 void RenderWidgetHostViewChildFrame::ProcessGestureEvent(
534 const blink::WebGestureEvent& event, 534 const blink::WebGestureEvent& event,
535 const ui::LatencyInfo& latency) { 535 const ui::LatencyInfo& latency) {
536 host_->ForwardGestureEventWithLatencyInfo(event, latency); 536 host_->ForwardGestureEventWithLatencyInfo(event, latency);
537 } 537 }
538 538
539 gfx::Point RenderWidgetHostViewChildFrame::TransformPointToRootCoordSpace( 539 gfx::Point RenderWidgetHostViewChildFrame::TransformPointToRootCoordSpace(
540 const gfx::Point& point) { 540 const gfx::Point& point) {
541 if (!frame_connector_ || !local_frame_id_.is_valid()) 541 if (!frame_connector_ || !local_surface_id_.is_valid())
542 return point; 542 return point;
543 543
544 return frame_connector_->TransformPointToRootCoordSpace( 544 return frame_connector_->TransformPointToRootCoordSpace(
545 point, cc::SurfaceId(frame_sink_id_, local_frame_id_)); 545 point, cc::SurfaceId(frame_sink_id_, local_surface_id_));
546 } 546 }
547 547
548 bool RenderWidgetHostViewChildFrame::TransformPointToLocalCoordSpace( 548 bool RenderWidgetHostViewChildFrame::TransformPointToLocalCoordSpace(
549 const gfx::Point& point, 549 const gfx::Point& point,
550 const cc::SurfaceId& original_surface, 550 const cc::SurfaceId& original_surface,
551 gfx::Point* transformed_point) { 551 gfx::Point* transformed_point) {
552 *transformed_point = point; 552 *transformed_point = point;
553 if (!frame_connector_ || !local_frame_id_.is_valid()) 553 if (!frame_connector_ || !local_surface_id_.is_valid())
554 return false; 554 return false;
555 555
556 return frame_connector_->TransformPointToLocalCoordSpace( 556 return frame_connector_->TransformPointToLocalCoordSpace(
557 point, original_surface, cc::SurfaceId(frame_sink_id_, local_frame_id_), 557 point, original_surface, cc::SurfaceId(frame_sink_id_, local_surface_id_),
558 transformed_point); 558 transformed_point);
559 } 559 }
560 560
561 bool RenderWidgetHostViewChildFrame::TransformPointToCoordSpaceForView( 561 bool RenderWidgetHostViewChildFrame::TransformPointToCoordSpaceForView(
562 const gfx::Point& point, 562 const gfx::Point& point,
563 RenderWidgetHostViewBase* target_view, 563 RenderWidgetHostViewBase* target_view,
564 gfx::Point* transformed_point) { 564 gfx::Point* transformed_point) {
565 if (!frame_connector_ || !local_frame_id_.is_valid()) 565 if (!frame_connector_ || !local_surface_id_.is_valid())
566 return false; 566 return false;
567 567
568 if (target_view == this) { 568 if (target_view == this) {
569 *transformed_point = point; 569 *transformed_point = point;
570 return true; 570 return true;
571 } 571 }
572 572
573 return frame_connector_->TransformPointToCoordSpaceForView( 573 return frame_connector_->TransformPointToCoordSpaceForView(
574 point, target_view, cc::SurfaceId(frame_sink_id_, local_frame_id_), 574 point, target_view, cc::SurfaceId(frame_sink_id_, local_surface_id_),
575 transformed_point); 575 transformed_point);
576 } 576 }
577 577
578 bool RenderWidgetHostViewChildFrame::IsRenderWidgetHostViewChildFrame() { 578 bool RenderWidgetHostViewChildFrame::IsRenderWidgetHostViewChildFrame() {
579 return true; 579 return true;
580 } 580 }
581 581
582 #if defined(OS_MACOSX) 582 #if defined(OS_MACOSX)
583 ui::AcceleratedWidgetMac* 583 ui::AcceleratedWidgetMac*
584 RenderWidgetHostViewChildFrame::GetAcceleratedWidgetMac() const { 584 RenderWidgetHostViewChildFrame::GetAcceleratedWidgetMac() const {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 744
745 BrowserAccessibilityManager* 745 BrowserAccessibilityManager*
746 RenderWidgetHostViewChildFrame::CreateBrowserAccessibilityManager( 746 RenderWidgetHostViewChildFrame::CreateBrowserAccessibilityManager(
747 BrowserAccessibilityDelegate* delegate, bool for_root_frame) { 747 BrowserAccessibilityDelegate* delegate, bool for_root_frame) {
748 return BrowserAccessibilityManager::Create( 748 return BrowserAccessibilityManager::Create(
749 BrowserAccessibilityManager::GetEmptyDocument(), delegate); 749 BrowserAccessibilityManager::GetEmptyDocument(), delegate);
750 } 750 }
751 751
752 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() { 752 void RenderWidgetHostViewChildFrame::ClearCompositorSurfaceIfNecessary() {
753 surface_factory_->EvictSurface(); 753 surface_factory_->EvictSurface();
754 local_frame_id_ = cc::LocalFrameId(); 754 local_surface_id_ = cc::LocalSurfaceId();
755 } 755 }
756 756
757 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const { 757 bool RenderWidgetHostViewChildFrame::IsChildFrameForTesting() const {
758 return true; 758 return true;
759 } 759 }
760 760
761 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const { 761 cc::SurfaceId RenderWidgetHostViewChildFrame::SurfaceIdForTesting() const {
762 return cc::SurfaceId(frame_sink_id_, local_frame_id_); 762 return cc::SurfaceId(frame_sink_id_, local_surface_id_);
763 }; 763 };
764 764
765 } // namespace content 765 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698