| 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/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include <memory> |
| 7 #include <utility> | 8 #include <utility> |
| 8 | 9 |
| 9 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 11 #include "base/bind.h" |
| 11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 12 #include "base/feature_list.h" | 13 #include "base/feature_list.h" |
| 13 #include "base/logging.h" | 14 #include "base/logging.h" |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 15 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/ptr_util.h" |
| 16 #include "base/memory/singleton.h" | 17 #include "base/memory/singleton.h" |
| 17 #include "base/message_loop/message_loop.h" | 18 #include "base/message_loop/message_loop.h" |
| 18 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
| 19 #include "base/stl_util.h" | 20 #include "base/stl_util.h" |
| 20 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 21 #include "base/sys_info.h" | 22 #include "base/sys_info.h" |
| 22 #include "base/trace_event/trace_event.h" | 23 #include "base/trace_event/trace_event.h" |
| 23 #include "base/trace_event/trace_event_synthetic_delay.h" | 24 #include "base/trace_event/trace_event_synthetic_delay.h" |
| 24 #include "build/build_config.h" | 25 #include "build/build_config.h" |
| 25 #include "cc/base/switches.h" | 26 #include "cc/base/switches.h" |
| (...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 SetHidden(false); | 639 SetHidden(false); |
| 639 FOR_EACH_OBSERVER(RenderFrameImpl, render_frames_, | 640 FOR_EACH_OBSERVER(RenderFrameImpl, render_frames_, |
| 640 WasShown()); | 641 WasShown()); |
| 641 | 642 |
| 642 if (!needs_repainting) | 643 if (!needs_repainting) |
| 643 return; | 644 return; |
| 644 | 645 |
| 645 // Generate a full repaint. | 646 // Generate a full repaint. |
| 646 if (compositor_) { | 647 if (compositor_) { |
| 647 ui::LatencyInfo swap_latency_info(latency_info); | 648 ui::LatencyInfo swap_latency_info(latency_info); |
| 648 scoped_ptr<cc::SwapPromiseMonitor> latency_info_swap_promise_monitor( | 649 std::unique_ptr<cc::SwapPromiseMonitor> latency_info_swap_promise_monitor( |
| 649 compositor_->CreateLatencyInfoSwapPromiseMonitor(&swap_latency_info)); | 650 compositor_->CreateLatencyInfoSwapPromiseMonitor(&swap_latency_info)); |
| 650 compositor_->SetNeedsForcedRedraw(); | 651 compositor_->SetNeedsForcedRedraw(); |
| 651 } | 652 } |
| 652 ScheduleComposite(); | 653 ScheduleComposite(); |
| 653 } | 654 } |
| 654 | 655 |
| 655 void RenderWidget::OnRequestMoveAck() { | 656 void RenderWidget::OnRequestMoveAck() { |
| 656 DCHECK(pending_window_rect_count_); | 657 DCHECK(pending_window_rect_count_); |
| 657 pending_window_rect_count_--; | 658 pending_window_rect_count_--; |
| 658 } | 659 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 float top_controls_delta) { | 696 float top_controls_delta) { |
| 696 webwidget_->applyViewportDeltas(inner_delta, outer_delta, | 697 webwidget_->applyViewportDeltas(inner_delta, outer_delta, |
| 697 elastic_overscroll_delta, page_scale, | 698 elastic_overscroll_delta, page_scale, |
| 698 top_controls_delta); | 699 top_controls_delta); |
| 699 } | 700 } |
| 700 | 701 |
| 701 void RenderWidget::BeginMainFrame(double frame_time_sec) { | 702 void RenderWidget::BeginMainFrame(double frame_time_sec) { |
| 702 webwidget_->beginFrame(frame_time_sec); | 703 webwidget_->beginFrame(frame_time_sec); |
| 703 } | 704 } |
| 704 | 705 |
| 705 scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface(bool fallback) { | 706 std::unique_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface( |
| 707 bool fallback) { |
| 706 DCHECK(webwidget_); | 708 DCHECK(webwidget_); |
| 707 // For widgets that are never visible, we don't start the compositor, so we | 709 // For widgets that are never visible, we don't start the compositor, so we |
| 708 // never get a request for a cc::OutputSurface. | 710 // never get a request for a cc::OutputSurface. |
| 709 DCHECK(!compositor_never_visible_); | 711 DCHECK(!compositor_never_visible_); |
| 710 | 712 |
| 711 const base::CommandLine& command_line = | 713 const base::CommandLine& command_line = |
| 712 *base::CommandLine::ForCurrentProcess(); | 714 *base::CommandLine::ForCurrentProcess(); |
| 713 bool use_software = fallback; | 715 bool use_software = fallback; |
| 714 if (command_line.HasSwitch(switches::kDisableGpuCompositing)) | 716 if (command_line.HasSwitch(switches::kDisableGpuCompositing)) |
| 715 use_software = true; | 717 use_software = true; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 742 #if defined(ENABLE_VULKAN) | 744 #if defined(ENABLE_VULKAN) |
| 743 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider; | 745 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider; |
| 744 #endif | 746 #endif |
| 745 scoped_refptr<ContextProviderCommandBuffer> context_provider; | 747 scoped_refptr<ContextProviderCommandBuffer> context_provider; |
| 746 scoped_refptr<ContextProviderCommandBuffer> worker_context_provider; | 748 scoped_refptr<ContextProviderCommandBuffer> worker_context_provider; |
| 747 if (!use_software) { | 749 if (!use_software) { |
| 748 #if defined(ENABLE_VULKAN) | 750 #if defined(ENABLE_VULKAN) |
| 749 vulkan_context_provider = cc::VulkanInProcessContextProvider::Create(); | 751 vulkan_context_provider = cc::VulkanInProcessContextProvider::Create(); |
| 750 if (vulkan_context_provider) { | 752 if (vulkan_context_provider) { |
| 751 uint32_t output_surface_id = next_output_surface_id_++; | 753 uint32_t output_surface_id = next_output_surface_id_++; |
| 752 return scoped_ptr<cc::OutputSurface>(new DelegatedCompositorOutputSurface( | 754 return std::unique_ptr<cc::OutputSurface>( |
| 753 routing_id(), output_surface_id, context_provider, | 755 new DelegatedCompositorOutputSurface( |
| 754 worker_context_provider, vulkan_context_provider, | 756 routing_id(), output_surface_id, context_provider, |
| 755 frame_swap_message_queue_)); | 757 worker_context_provider, vulkan_context_provider, |
| 758 frame_swap_message_queue_)); |
| 756 } | 759 } |
| 757 #endif | 760 #endif |
| 758 | 761 |
| 759 context_provider = ContextProviderCommandBuffer::Create( | 762 context_provider = ContextProviderCommandBuffer::Create( |
| 760 CreateGraphicsContext3D(gpu_channel_host.get()), | 763 CreateGraphicsContext3D(gpu_channel_host.get()), |
| 761 RENDER_COMPOSITOR_CONTEXT); | 764 RENDER_COMPOSITOR_CONTEXT); |
| 762 DCHECK(context_provider); | 765 DCHECK(context_provider); |
| 763 worker_context_provider = | 766 worker_context_provider = |
| 764 RenderThreadImpl::current()->SharedWorkerContextProvider(); | 767 RenderThreadImpl::current()->SharedWorkerContextProvider(); |
| 765 if (!worker_context_provider) { | 768 if (!worker_context_provider) { |
| 766 // Cause the compositor to wait and try again. | 769 // Cause the compositor to wait and try again. |
| 767 return nullptr; | 770 return nullptr; |
| 768 } | 771 } |
| 769 | 772 |
| 770 #if defined(OS_ANDROID) | 773 #if defined(OS_ANDROID) |
| 771 if (SynchronousCompositorFactory* factory = | 774 if (SynchronousCompositorFactory* factory = |
| 772 SynchronousCompositorFactory::GetInstance()) { | 775 SynchronousCompositorFactory::GetInstance()) { |
| 773 uint32_t output_surface_id = next_output_surface_id_++; | 776 uint32_t output_surface_id = next_output_surface_id_++; |
| 774 return factory->CreateOutputSurface( | 777 return factory->CreateOutputSurface( |
| 775 routing_id(), output_surface_id, frame_swap_message_queue_, | 778 routing_id(), output_surface_id, frame_swap_message_queue_, |
| 776 context_provider, worker_context_provider); | 779 context_provider, worker_context_provider); |
| 777 } else if (RenderThreadImpl::current()->sync_compositor_message_filter()) { | 780 } else if (RenderThreadImpl::current()->sync_compositor_message_filter()) { |
| 778 uint32_t output_surface_id = next_output_surface_id_++; | 781 uint32_t output_surface_id = next_output_surface_id_++; |
| 779 return make_scoped_ptr(new SynchronousCompositorOutputSurface( | 782 return base::WrapUnique(new SynchronousCompositorOutputSurface( |
| 780 context_provider, worker_context_provider, routing_id(), | 783 context_provider, worker_context_provider, routing_id(), |
| 781 output_surface_id, content::RenderThreadImpl::current() | 784 output_surface_id, content::RenderThreadImpl::current() |
| 782 ->sync_compositor_message_filter(), | 785 ->sync_compositor_message_filter(), |
| 783 frame_swap_message_queue_)); | 786 frame_swap_message_queue_)); |
| 784 } | 787 } |
| 785 #endif | 788 #endif |
| 786 } | 789 } |
| 787 | 790 |
| 788 uint32_t output_surface_id = next_output_surface_id_++; | 791 uint32_t output_surface_id = next_output_surface_id_++; |
| 789 // Composite-to-mailbox is currently used for layout tests in order to cause | 792 // Composite-to-mailbox is currently used for layout tests in order to cause |
| 790 // them to draw inside in the renderer to do the readback there. This should | 793 // them to draw inside in the renderer to do the readback there. This should |
| 791 // no longer be the case when crbug.com/311404 is fixed. | 794 // no longer be the case when crbug.com/311404 is fixed. |
| 792 if (!RenderThreadImpl::current() || | 795 if (!RenderThreadImpl::current() || |
| 793 !RenderThreadImpl::current()->layout_test_mode()) { | 796 !RenderThreadImpl::current()->layout_test_mode()) { |
| 794 DCHECK(compositor_deps_->GetCompositorImplThreadTaskRunner()); | 797 DCHECK(compositor_deps_->GetCompositorImplThreadTaskRunner()); |
| 795 return make_scoped_ptr(new DelegatedCompositorOutputSurface( | 798 return base::WrapUnique(new DelegatedCompositorOutputSurface( |
| 796 routing_id(), output_surface_id, context_provider, | 799 routing_id(), output_surface_id, context_provider, |
| 797 worker_context_provider, | 800 worker_context_provider, |
| 798 #if defined(ENABLE_VULKAN) | 801 #if defined(ENABLE_VULKAN) |
| 799 vulkan_context_provider, | 802 vulkan_context_provider, |
| 800 #endif | 803 #endif |
| 801 frame_swap_message_queue_)); | 804 frame_swap_message_queue_)); |
| 802 } | 805 } |
| 803 | 806 |
| 804 if (!context_provider.get()) { | 807 if (!context_provider.get()) { |
| 805 scoped_ptr<cc::SoftwareOutputDevice> software_device( | 808 std::unique_ptr<cc::SoftwareOutputDevice> software_device( |
| 806 new cc::SoftwareOutputDevice()); | 809 new cc::SoftwareOutputDevice()); |
| 807 | 810 |
| 808 return make_scoped_ptr(new CompositorOutputSurface( | 811 return base::WrapUnique(new CompositorOutputSurface( |
| 809 routing_id(), output_surface_id, nullptr, nullptr, | 812 routing_id(), output_surface_id, nullptr, nullptr, |
| 810 #if defined(ENABLE_VULKAN) | 813 #if defined(ENABLE_VULKAN) |
| 811 nullptr, | 814 nullptr, |
| 812 #endif | 815 #endif |
| 813 std::move(software_device), frame_swap_message_queue_, true)); | 816 std::move(software_device), frame_swap_message_queue_, true)); |
| 814 } | 817 } |
| 815 | 818 |
| 816 return make_scoped_ptr(new MailboxOutputSurface( | 819 return base::WrapUnique(new MailboxOutputSurface( |
| 817 routing_id(), output_surface_id, context_provider, | 820 routing_id(), output_surface_id, context_provider, |
| 818 worker_context_provider, frame_swap_message_queue_, cc::RGBA_8888)); | 821 worker_context_provider, frame_swap_message_queue_, cc::RGBA_8888)); |
| 819 } | 822 } |
| 820 | 823 |
| 821 scoped_ptr<cc::BeginFrameSource> | 824 std::unique_ptr<cc::BeginFrameSource> |
| 822 RenderWidget::CreateExternalBeginFrameSource() { | 825 RenderWidget::CreateExternalBeginFrameSource() { |
| 823 return compositor_deps_->CreateExternalBeginFrameSource(routing_id_); | 826 return compositor_deps_->CreateExternalBeginFrameSource(routing_id_); |
| 824 } | 827 } |
| 825 | 828 |
| 826 void RenderWidget::DidCommitAndDrawCompositorFrame() { | 829 void RenderWidget::DidCommitAndDrawCompositorFrame() { |
| 827 // NOTE: Tests may break if this event is renamed or moved. See | 830 // NOTE: Tests may break if this event is renamed or moved. See |
| 828 // tab_capture_performancetest.cc. | 831 // tab_capture_performancetest.cc. |
| 829 TRACE_EVENT0("gpu", "RenderWidget::DidCommitAndDrawCompositorFrame"); | 832 TRACE_EVENT0("gpu", "RenderWidget::DidCommitAndDrawCompositorFrame"); |
| 830 // Notify subclasses that we initiated the paint operation. | 833 // Notify subclasses that we initiated the paint operation. |
| 831 DidInitiatePaint(); | 834 DidInitiatePaint(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 | 892 |
| 890 // Notify subclasses that composited rendering was flushed to the screen. | 893 // Notify subclasses that composited rendering was flushed to the screen. |
| 891 DidFlushPaint(); | 894 DidFlushPaint(); |
| 892 } | 895 } |
| 893 | 896 |
| 894 void RenderWidget::OnSwapBuffersPosted() { | 897 void RenderWidget::OnSwapBuffersPosted() { |
| 895 TRACE_EVENT0("renderer", "RenderWidget::OnSwapBuffersPosted"); | 898 TRACE_EVENT0("renderer", "RenderWidget::OnSwapBuffersPosted"); |
| 896 } | 899 } |
| 897 | 900 |
| 898 void RenderWidget::RecordFrameTimingEvents( | 901 void RenderWidget::RecordFrameTimingEvents( |
| 899 scoped_ptr<cc::FrameTimingTracker::CompositeTimingSet> composite_events, | 902 std::unique_ptr<cc::FrameTimingTracker::CompositeTimingSet> |
| 900 scoped_ptr<cc::FrameTimingTracker::MainFrameTimingSet> main_frame_events) { | 903 composite_events, |
| 904 std::unique_ptr<cc::FrameTimingTracker::MainFrameTimingSet> |
| 905 main_frame_events) { |
| 901 for (const auto& composite_event : *composite_events) { | 906 for (const auto& composite_event : *composite_events) { |
| 902 int64_t frameId = composite_event.first; | 907 int64_t frameId = composite_event.first; |
| 903 const std::vector<cc::FrameTimingTracker::CompositeTimingEvent>& events = | 908 const std::vector<cc::FrameTimingTracker::CompositeTimingEvent>& events = |
| 904 composite_event.second; | 909 composite_event.second; |
| 905 std::vector<blink::WebFrameTimingEvent> webEvents; | 910 std::vector<blink::WebFrameTimingEvent> webEvents; |
| 906 for (size_t i = 0; i < events.size(); ++i) { | 911 for (size_t i = 0; i < events.size(); ++i) { |
| 907 webEvents.push_back(blink::WebFrameTimingEvent( | 912 webEvents.push_back(blink::WebFrameTimingEvent( |
| 908 events[i].frame_id, | 913 events[i].frame_id, |
| 909 (events[i].timestamp - base::TimeTicks()).InSecondsF())); | 914 (events[i].timestamp - base::TimeTicks()).InSecondsF())); |
| 910 } | 915 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 | 1012 |
| 1008 void RenderWidget::OnDidHandleKeyEvent() { | 1013 void RenderWidget::OnDidHandleKeyEvent() { |
| 1009 if (owner_delegate_) | 1014 if (owner_delegate_) |
| 1010 owner_delegate_->RenderWidgetDidHandleKeyEvent(); | 1015 owner_delegate_->RenderWidgetDidHandleKeyEvent(); |
| 1011 } | 1016 } |
| 1012 | 1017 |
| 1013 void RenderWidget::OnDidOverscroll(const DidOverscrollParams& params) { | 1018 void RenderWidget::OnDidOverscroll(const DidOverscrollParams& params) { |
| 1014 Send(new InputHostMsg_DidOverscroll(routing_id_, params)); | 1019 Send(new InputHostMsg_DidOverscroll(routing_id_, params)); |
| 1015 } | 1020 } |
| 1016 | 1021 |
| 1017 void RenderWidget::OnInputEventAck(scoped_ptr<InputEventAck> input_event_ack) { | 1022 void RenderWidget::OnInputEventAck( |
| 1023 std::unique_ptr<InputEventAck> input_event_ack) { |
| 1018 Send(new InputHostMsg_HandleInputEvent_ACK(routing_id_, *input_event_ack)); | 1024 Send(new InputHostMsg_HandleInputEvent_ACK(routing_id_, *input_event_ack)); |
| 1019 } | 1025 } |
| 1020 | 1026 |
| 1021 void RenderWidget::NotifyInputEventHandled( | 1027 void RenderWidget::NotifyInputEventHandled( |
| 1022 blink::WebInputEvent::Type handled_type) { | 1028 blink::WebInputEvent::Type handled_type) { |
| 1023 RenderThreadImpl* render_thread = RenderThreadImpl::current(); | 1029 RenderThreadImpl* render_thread = RenderThreadImpl::current(); |
| 1024 InputHandlerManager* input_handler_manager = | 1030 InputHandlerManager* input_handler_manager = |
| 1025 render_thread ? render_thread->input_handler_manager() : NULL; | 1031 render_thread ? render_thread->input_handler_manager() : NULL; |
| 1026 if (input_handler_manager) { | 1032 if (input_handler_manager) { |
| 1027 input_handler_manager->NotifyInputEventHandledOnMainThread(routing_id_, | 1033 input_handler_manager->NotifyInputEventHandledOnMainThread(routing_id_, |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1309 // Regardless of whether threaded compositing is enabled, always | 1315 // Regardless of whether threaded compositing is enabled, always |
| 1310 // use this mechanism to force the compositor to redraw. However, | 1316 // use this mechanism to force the compositor to redraw. However, |
| 1311 // the invalidation code path below is still needed for the | 1317 // the invalidation code path below is still needed for the |
| 1312 // non-threaded case. | 1318 // non-threaded case. |
| 1313 compositor_->SetNeedsForcedRedraw(); | 1319 compositor_->SetNeedsForcedRedraw(); |
| 1314 } | 1320 } |
| 1315 ScheduleComposite(); | 1321 ScheduleComposite(); |
| 1316 } | 1322 } |
| 1317 | 1323 |
| 1318 // static | 1324 // static |
| 1319 scoped_ptr<cc::SwapPromise> RenderWidget::QueueMessageImpl( | 1325 std::unique_ptr<cc::SwapPromise> RenderWidget::QueueMessageImpl( |
| 1320 IPC::Message* msg, | 1326 IPC::Message* msg, |
| 1321 MessageDeliveryPolicy policy, | 1327 MessageDeliveryPolicy policy, |
| 1322 FrameSwapMessageQueue* frame_swap_message_queue, | 1328 FrameSwapMessageQueue* frame_swap_message_queue, |
| 1323 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter, | 1329 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter, |
| 1324 int source_frame_number) { | 1330 int source_frame_number) { |
| 1325 bool first_message_for_frame = false; | 1331 bool first_message_for_frame = false; |
| 1326 frame_swap_message_queue->QueueMessageForFrame(policy, | 1332 frame_swap_message_queue->QueueMessageForFrame(policy, source_frame_number, |
| 1327 source_frame_number, | 1333 base::WrapUnique(msg), |
| 1328 make_scoped_ptr(msg), | |
| 1329 &first_message_for_frame); | 1334 &first_message_for_frame); |
| 1330 if (first_message_for_frame) { | 1335 if (first_message_for_frame) { |
| 1331 scoped_ptr<cc::SwapPromise> promise(new QueueMessageSwapPromise( | 1336 std::unique_ptr<cc::SwapPromise> promise(new QueueMessageSwapPromise( |
| 1332 sync_message_filter, frame_swap_message_queue, source_frame_number)); | 1337 sync_message_filter, frame_swap_message_queue, source_frame_number)); |
| 1333 return promise; | 1338 return promise; |
| 1334 } | 1339 } |
| 1335 return nullptr; | 1340 return nullptr; |
| 1336 } | 1341 } |
| 1337 | 1342 |
| 1338 void RenderWidget::QueueMessage(IPC::Message* msg, | 1343 void RenderWidget::QueueMessage(IPC::Message* msg, |
| 1339 MessageDeliveryPolicy policy) { | 1344 MessageDeliveryPolicy policy) { |
| 1340 // RenderThreadImpl::current() is NULL in some tests. | 1345 // RenderThreadImpl::current() is NULL in some tests. |
| 1341 if (!compositor_ || !RenderThreadImpl::current()) { | 1346 if (!compositor_ || !RenderThreadImpl::current()) { |
| 1342 Send(msg); | 1347 Send(msg); |
| 1343 return; | 1348 return; |
| 1344 } | 1349 } |
| 1345 | 1350 |
| 1346 scoped_ptr<cc::SwapPromise> swap_promise = | 1351 std::unique_ptr<cc::SwapPromise> swap_promise = |
| 1347 QueueMessageImpl(msg, | 1352 QueueMessageImpl(msg, policy, frame_swap_message_queue_.get(), |
| 1348 policy, | |
| 1349 frame_swap_message_queue_.get(), | |
| 1350 RenderThreadImpl::current()->sync_message_filter(), | 1353 RenderThreadImpl::current()->sync_message_filter(), |
| 1351 compositor_->GetSourceFrameNumber()); | 1354 compositor_->GetSourceFrameNumber()); |
| 1352 | 1355 |
| 1353 if (swap_promise) { | 1356 if (swap_promise) { |
| 1354 compositor_->QueueSwapPromise(std::move(swap_promise)); | 1357 compositor_->QueueSwapPromise(std::move(swap_promise)); |
| 1355 // Request a commit. This might either A) request a commit ahead of time | 1358 // Request a commit. This might either A) request a commit ahead of time |
| 1356 // or B) request a commit which is not needed because there are not | 1359 // or B) request a commit which is not needed because there are not |
| 1357 // pending updates. If B) then the commit will be skipped and the swap | 1360 // pending updates. If B) then the commit will be skipped and the swap |
| 1358 // promises will be broken (see EarlyOut_NoUpdates). To achieve that we | 1361 // promises will be broken (see EarlyOut_NoUpdates). To achieve that we |
| 1359 // call SetNeedsUpdateLayers instead of SetNeedsCommit so that | 1362 // call SetNeedsUpdateLayers instead of SetNeedsCommit so that |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1424 // Ask the RenderWidgetHost to initiate close. We could be called from deep | 1427 // Ask the RenderWidgetHost to initiate close. We could be called from deep |
| 1425 // in Javascript. If we ask the RendwerWidgetHost to close now, the window | 1428 // in Javascript. If we ask the RendwerWidgetHost to close now, the window |
| 1426 // could be closed before the JS finishes executing. So instead, post a | 1429 // could be closed before the JS finishes executing. So instead, post a |
| 1427 // message back to the message loop, which won't run until the JS is | 1430 // message back to the message loop, which won't run until the JS is |
| 1428 // complete, and then the Close message can be sent. | 1431 // complete, and then the Close message can be sent. |
| 1429 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1432 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1430 FROM_HERE, base::Bind(&RenderWidget::DoDeferredClose, this)); | 1433 FROM_HERE, base::Bind(&RenderWidget::DoDeferredClose, this)); |
| 1431 } | 1434 } |
| 1432 | 1435 |
| 1433 void RenderWidget::QueueSyntheticGesture( | 1436 void RenderWidget::QueueSyntheticGesture( |
| 1434 scoped_ptr<SyntheticGestureParams> gesture_params, | 1437 std::unique_ptr<SyntheticGestureParams> gesture_params, |
| 1435 const SyntheticGestureCompletionCallback& callback) { | 1438 const SyntheticGestureCompletionCallback& callback) { |
| 1436 DCHECK(!callback.is_null()); | 1439 DCHECK(!callback.is_null()); |
| 1437 | 1440 |
| 1438 pending_synthetic_gesture_callbacks_.push(callback); | 1441 pending_synthetic_gesture_callbacks_.push(callback); |
| 1439 | 1442 |
| 1440 SyntheticGesturePacket gesture_packet; | 1443 SyntheticGesturePacket gesture_packet; |
| 1441 gesture_packet.set_gesture_params(std::move(gesture_params)); | 1444 gesture_packet.set_gesture_params(std::move(gesture_params)); |
| 1442 | 1445 |
| 1443 Send(new InputHostMsg_QueueSyntheticGesture(routing_id_, gesture_packet)); | 1446 Send(new InputHostMsg_QueueSyntheticGesture(routing_id_, gesture_packet)); |
| 1444 } | 1447 } |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2086 Send(new InputHostMsg_SetTouchAction(routing_id_, content_touch_action)); | 2089 Send(new InputHostMsg_SetTouchAction(routing_id_, content_touch_action)); |
| 2087 } | 2090 } |
| 2088 | 2091 |
| 2089 void RenderWidget::didUpdateTextOfFocusedElementByNonUserInput() { | 2092 void RenderWidget::didUpdateTextOfFocusedElementByNonUserInput() { |
| 2090 #if defined(OS_ANDROID) | 2093 #if defined(OS_ANDROID) |
| 2091 if (!IsUsingImeThread()) | 2094 if (!IsUsingImeThread()) |
| 2092 text_field_is_dirty_ = true; | 2095 text_field_is_dirty_ = true; |
| 2093 #endif | 2096 #endif |
| 2094 } | 2097 } |
| 2095 | 2098 |
| 2096 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> | 2099 std::unique_ptr<WebGraphicsContext3DCommandBufferImpl> |
| 2097 RenderWidget::CreateGraphicsContext3D(gpu::GpuChannelHost* gpu_channel_host) { | 2100 RenderWidget::CreateGraphicsContext3D(gpu::GpuChannelHost* gpu_channel_host) { |
| 2098 // This is for an offscreen context for raster in the compositor. So the | 2101 // This is for an offscreen context for raster in the compositor. So the |
| 2099 // default framebuffer doesn't need alpha, depth, stencil, antialiasing. | 2102 // default framebuffer doesn't need alpha, depth, stencil, antialiasing. |
| 2100 gpu::gles2::ContextCreationAttribHelper attributes; | 2103 gpu::gles2::ContextCreationAttribHelper attributes; |
| 2101 attributes.alpha_size = -1; | 2104 attributes.alpha_size = -1; |
| 2102 attributes.depth_size = 0; | 2105 attributes.depth_size = 0; |
| 2103 attributes.stencil_size = 0; | 2106 attributes.stencil_size = 0; |
| 2104 attributes.samples = 0; | 2107 attributes.samples = 0; |
| 2105 attributes.sample_buffers = 0; | 2108 attributes.sample_buffers = 0; |
| 2106 attributes.bind_generates_resource = false; | 2109 attributes.bind_generates_resource = false; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2136 limits.mapped_memory_reclaim_limit = | 2139 limits.mapped_memory_reclaim_limit = |
| 2137 max_transfer_buffer_usage_mb * kBytesPerMegabyte; | 2140 max_transfer_buffer_usage_mb * kBytesPerMegabyte; |
| 2138 #endif | 2141 #endif |
| 2139 limits.command_buffer_size = 64 * 1024; | 2142 limits.command_buffer_size = 64 * 1024; |
| 2140 limits.start_transfer_buffer_size = 64 * 1024; | 2143 limits.start_transfer_buffer_size = 64 * 1024; |
| 2141 limits.min_transfer_buffer_size = 64 * 1024; | 2144 limits.min_transfer_buffer_size = 64 * 1024; |
| 2142 | 2145 |
| 2143 bool share_resources = true; | 2146 bool share_resources = true; |
| 2144 bool automatic_flushes = false; | 2147 bool automatic_flushes = false; |
| 2145 | 2148 |
| 2146 return make_scoped_ptr(new WebGraphicsContext3DCommandBufferImpl( | 2149 return base::WrapUnique(new WebGraphicsContext3DCommandBufferImpl( |
| 2147 gpu::kNullSurfaceHandle, GetURLForGraphicsContext3D(), gpu_channel_host, | 2150 gpu::kNullSurfaceHandle, GetURLForGraphicsContext3D(), gpu_channel_host, |
| 2148 attributes, gfx::PreferIntegratedGpu, share_resources, automatic_flushes, | 2151 attributes, gfx::PreferIntegratedGpu, share_resources, automatic_flushes, |
| 2149 limits, nullptr)); | 2152 limits, nullptr)); |
| 2150 } | 2153 } |
| 2151 | 2154 |
| 2152 void RenderWidget::RegisterRenderFrameProxy(RenderFrameProxy* proxy) { | 2155 void RenderWidget::RegisterRenderFrameProxy(RenderFrameProxy* proxy) { |
| 2153 render_frame_proxies_.AddObserver(proxy); | 2156 render_frame_proxies_.AddObserver(proxy); |
| 2154 } | 2157 } |
| 2155 | 2158 |
| 2156 void RenderWidget::UnregisterRenderFrameProxy(RenderFrameProxy* proxy) { | 2159 void RenderWidget::UnregisterRenderFrameProxy(RenderFrameProxy* proxy) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2181 } | 2184 } |
| 2182 | 2185 |
| 2183 float RenderWidget::GetOriginalDeviceScaleFactor() const { | 2186 float RenderWidget::GetOriginalDeviceScaleFactor() const { |
| 2184 return | 2187 return |
| 2185 screen_metrics_emulator_ ? | 2188 screen_metrics_emulator_ ? |
| 2186 screen_metrics_emulator_->original_screen_info().deviceScaleFactor : | 2189 screen_metrics_emulator_->original_screen_info().deviceScaleFactor : |
| 2187 device_scale_factor_; | 2190 device_scale_factor_; |
| 2188 } | 2191 } |
| 2189 | 2192 |
| 2190 } // namespace content | 2193 } // namespace content |
| OLD | NEW |