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

Side by Side Diff: content/browser/renderer_host/delegated_frame_host.cc

Issue 2951053005: Add Mojo API for Blink hit testing (Closed)
Patch Set: Address Rob's comments Created 3 years, 4 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/renderer_host/delegated_frame_host.h" 5 #include "content/browser/renderer_host/delegated_frame_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 // To avoid unnecessary browser composites, try to go directly to the Surface 368 // To avoid unnecessary browser composites, try to go directly to the Surface
369 // rather than through the Layer (which goes through the browser compositor). 369 // rather than through the Layer (which goes through the browser compositor).
370 if (has_frame_ && request_copy_of_output_callback_for_testing_.is_null()) { 370 if (has_frame_ && request_copy_of_output_callback_for_testing_.is_null()) {
371 support_->RequestCopyOfSurface(std::move(request)); 371 support_->RequestCopyOfSurface(std::move(request));
372 } else { 372 } else {
373 RequestCopyOfOutput(std::move(request)); 373 RequestCopyOfOutput(std::move(request));
374 } 374 }
375 } 375 }
376 376
377 void DelegatedFrameHost::DidCreateNewRendererCompositorFrameSink( 377 void DelegatedFrameHost::DidCreateNewRendererCompositorFrameSink(
378 viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink) { 378 viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink,
379 viz::mojom::TargetFrameForInputDelegate* input_delegate) {
379 ResetCompositorFrameSinkSupport(); 380 ResetCompositorFrameSinkSupport();
380 renderer_compositor_frame_sink_ = renderer_compositor_frame_sink; 381 renderer_compositor_frame_sink_ = renderer_compositor_frame_sink;
381 CreateCompositorFrameSinkSupport(); 382 CreateCompositorFrameSinkSupport(input_delegate);
382 has_frame_ = false; 383 has_frame_ = false;
383 } 384 }
384 385
385 void DelegatedFrameHost::SubmitCompositorFrame( 386 void DelegatedFrameHost::SubmitCompositorFrame(
386 const viz::LocalSurfaceId& local_surface_id, 387 const viz::LocalSurfaceId& local_surface_id,
387 cc::CompositorFrame frame) { 388 cc::CompositorFrame frame) {
388 #if defined(OS_CHROMEOS) 389 #if defined(OS_CHROMEOS)
389 DCHECK(!resize_lock_ || !client_->IsAutoResizeEnabled()); 390 DCHECK(!resize_lock_ || !client_->IsAutoResizeEnabled());
390 #endif 391 #endif
391 float frame_device_scale_factor = frame.metadata.device_scale_factor; 392 float frame_device_scale_factor = frame.metadata.device_scale_factor;
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 } else { 828 } else {
828 request_copy_of_output_callback_for_testing_.Run(std::move(request)); 829 request_copy_of_output_callback_for_testing_.Run(std::move(request));
829 } 830 }
830 } 831 }
831 832
832 void DelegatedFrameHost::UnlockResources() { 833 void DelegatedFrameHost::UnlockResources() {
833 DCHECK(local_surface_id_.is_valid()); 834 DCHECK(local_surface_id_.is_valid());
834 frame_evictor_->UnlockFrame(); 835 frame_evictor_->UnlockFrame();
835 } 836 }
836 837
837 void DelegatedFrameHost::CreateCompositorFrameSinkSupport() { 838 void DelegatedFrameHost::CreateCompositorFrameSinkSupport(
839 viz::mojom::TargetFrameForInputDelegate* input_delegate) {
838 DCHECK(!support_); 840 DCHECK(!support_);
839 constexpr bool is_root = false; 841 constexpr bool is_root = false;
840 constexpr bool handles_frame_sink_id_invalidation = false; 842 constexpr bool handles_frame_sink_id_invalidation = false;
841 constexpr bool needs_sync_points = true; 843 constexpr bool needs_sync_points = true;
842 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 844 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
843 support_ = factory->GetContextFactoryPrivate() 845 support_ = factory->GetContextFactoryPrivate()
844 ->GetHostFrameSinkManager() 846 ->GetHostFrameSinkManager()
845 ->CreateCompositorFrameSinkSupport( 847 ->CreateCompositorFrameSinkSupport(
846 this, frame_sink_id_, is_root, 848 this, input_delegate, frame_sink_id_, is_root,
847 handles_frame_sink_id_invalidation, needs_sync_points); 849 handles_frame_sink_id_invalidation, needs_sync_points);
848 if (compositor_) 850 if (compositor_)
849 compositor_->AddFrameSink(frame_sink_id_); 851 compositor_->AddFrameSink(frame_sink_id_);
850 if (needs_begin_frame_) 852 if (needs_begin_frame_)
851 support_->SetNeedsBeginFrame(true); 853 support_->SetNeedsBeginFrame(true);
852 } 854 }
853 855
854 void DelegatedFrameHost::ResetCompositorFrameSinkSupport() { 856 void DelegatedFrameHost::ResetCompositorFrameSinkSupport() {
855 if (!support_) 857 if (!support_)
856 return; 858 return;
857 if (compositor_) 859 if (compositor_)
858 compositor_->RemoveFrameSink(frame_sink_id_); 860 compositor_->RemoveFrameSink(frame_sink_id_);
859 support_.reset(); 861 support_.reset();
860 } 862 }
861 863
862 } // namespace content 864 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/delegated_frame_host.h ('k') | content/browser/renderer_host/frame_sink_provider_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698