| 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_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 ui::GpuService::Create(GetServiceManagerConnection()->GetConnector(), | 652 ui::GpuService::Create(GetServiceManagerConnection()->GetConnector(), |
| 653 ChildProcess::current()->io_task_runner()); | 653 ChildProcess::current()->io_task_runner()); |
| 654 } | 654 } |
| 655 #endif | 655 #endif |
| 656 gpu_memory_buffer_manager_ = | 656 gpu_memory_buffer_manager_ = |
| 657 base::MakeUnique<ChildGpuMemoryBufferManager>(thread_safe_sender()); | 657 base::MakeUnique<ChildGpuMemoryBufferManager>(thread_safe_sender()); |
| 658 | 658 |
| 659 InitializeWebKit(resource_task_queue); | 659 InitializeWebKit(resource_task_queue); |
| 660 | 660 |
| 661 // In single process the single process is all there is. | 661 // In single process the single process is all there is. |
| 662 notify_webkit_of_modal_loop_ = true; |
| 662 webkit_shared_timer_suspended_ = false; | 663 webkit_shared_timer_suspended_ = false; |
| 663 widget_count_ = 0; | 664 widget_count_ = 0; |
| 664 hidden_widget_count_ = 0; | 665 hidden_widget_count_ = 0; |
| 665 idle_notification_delay_in_ms_ = kInitialIdleHandlerDelayMs; | 666 idle_notification_delay_in_ms_ = kInitialIdleHandlerDelayMs; |
| 666 idle_notifications_to_skip_ = 0; | 667 idle_notifications_to_skip_ = 0; |
| 667 | 668 |
| 668 appcache_dispatcher_.reset( | 669 appcache_dispatcher_.reset( |
| 669 new AppCacheDispatcher(Get(), new AppCacheFrontendImpl())); | 670 new AppCacheDispatcher(Get(), new AppCacheFrontendImpl())); |
| 670 dom_storage_dispatcher_.reset(new DomStorageDispatcher()); | 671 dom_storage_dispatcher_.reset(new DomStorageDispatcher()); |
| 671 main_thread_indexed_db_dispatcher_.reset(new IndexedDBDispatcher()); | 672 main_thread_indexed_db_dispatcher_.reset(new IndexedDBDispatcher()); |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 // may create an opportunity for re-entrancy into WebKit and other subsystems, | 1048 // may create an opportunity for re-entrancy into WebKit and other subsystems, |
| 1048 // so we need to take care to disable callbacks, timers, and pending network | 1049 // so we need to take care to disable callbacks, timers, and pending network |
| 1049 // loads that could trigger such callbacks. | 1050 // loads that could trigger such callbacks. |
| 1050 bool pumping_events = false; | 1051 bool pumping_events = false; |
| 1051 if (msg->is_sync()) { | 1052 if (msg->is_sync()) { |
| 1052 if (msg->is_caller_pumping_messages()) { | 1053 if (msg->is_caller_pumping_messages()) { |
| 1053 pumping_events = true; | 1054 pumping_events = true; |
| 1054 } | 1055 } |
| 1055 } | 1056 } |
| 1056 | 1057 |
| 1058 bool notify_webkit_of_modal_loop = true; |
| 1059 std::swap(notify_webkit_of_modal_loop, notify_webkit_of_modal_loop_); |
| 1060 |
| 1057 if (pumping_events) { | 1061 if (pumping_events) { |
| 1058 renderer_scheduler_->SuspendTimerQueue(); | 1062 renderer_scheduler_->SuspendTimerQueue(); |
| 1059 WebView::willEnterModalLoop(); | 1063 if (notify_webkit_of_modal_loop) |
| 1064 WebView::willEnterModalLoop(); |
| 1060 } | 1065 } |
| 1061 | 1066 |
| 1062 bool rv = ChildThreadImpl::Send(msg); | 1067 bool rv = ChildThreadImpl::Send(msg); |
| 1063 | 1068 |
| 1064 if (pumping_events) { | 1069 if (pumping_events) { |
| 1065 WebView::didExitModalLoop(); | 1070 if (notify_webkit_of_modal_loop) |
| 1071 WebView::didExitModalLoop(); |
| 1072 |
| 1066 renderer_scheduler_->ResumeTimerQueue(); | 1073 renderer_scheduler_->ResumeTimerQueue(); |
| 1067 } | 1074 } |
| 1068 | 1075 |
| 1069 return rv; | 1076 return rv; |
| 1070 } | 1077 } |
| 1071 | 1078 |
| 1072 IPC::SyncChannel* RenderThreadImpl::GetChannel() { | 1079 IPC::SyncChannel* RenderThreadImpl::GetChannel() { |
| 1073 return channel(); | 1080 return channel(); |
| 1074 } | 1081 } |
| 1075 | 1082 |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1704 scoped_refptr<base::SingleThreadTaskRunner> | 1711 scoped_refptr<base::SingleThreadTaskRunner> |
| 1705 RenderThreadImpl::GetIOThreadTaskRunner() { | 1712 RenderThreadImpl::GetIOThreadTaskRunner() { |
| 1706 return io_thread_task_runner_; | 1713 return io_thread_task_runner_; |
| 1707 } | 1714 } |
| 1708 | 1715 |
| 1709 std::unique_ptr<base::SharedMemory> RenderThreadImpl::AllocateSharedMemory( | 1716 std::unique_ptr<base::SharedMemory> RenderThreadImpl::AllocateSharedMemory( |
| 1710 size_t size) { | 1717 size_t size) { |
| 1711 return HostAllocateSharedMemoryBuffer(size); | 1718 return HostAllocateSharedMemoryBuffer(size); |
| 1712 } | 1719 } |
| 1713 | 1720 |
| 1721 void RenderThreadImpl::DoNotNotifyWebKitOfModalLoop() { |
| 1722 notify_webkit_of_modal_loop_ = false; |
| 1723 } |
| 1724 |
| 1714 void RenderThreadImpl::OnChannelError() { | 1725 void RenderThreadImpl::OnChannelError() { |
| 1715 // In single-process mode, the renderer can't be restarted after shutdown. | 1726 // In single-process mode, the renderer can't be restarted after shutdown. |
| 1716 // So, if we get a channel error, crash the whole process right now to get a | 1727 // So, if we get a channel error, crash the whole process right now to get a |
| 1717 // more informative stack, since we will otherwise just crash later when we | 1728 // more informative stack, since we will otherwise just crash later when we |
| 1718 // try to restart it. | 1729 // try to restart it. |
| 1719 CHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch( | 1730 CHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1720 switches::kSingleProcess)); | 1731 switches::kSingleProcess)); |
| 1721 ChildThreadImpl::OnChannelError(); | 1732 ChildThreadImpl::OnChannelError(); |
| 1722 } | 1733 } |
| 1723 | 1734 |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2485 } | 2496 } |
| 2486 } | 2497 } |
| 2487 | 2498 |
| 2488 void RenderThreadImpl::OnRendererInterfaceRequest( | 2499 void RenderThreadImpl::OnRendererInterfaceRequest( |
| 2489 mojom::RendererAssociatedRequest request) { | 2500 mojom::RendererAssociatedRequest request) { |
| 2490 DCHECK(!renderer_binding_.is_bound()); | 2501 DCHECK(!renderer_binding_.is_bound()); |
| 2491 renderer_binding_.Bind(std::move(request)); | 2502 renderer_binding_.Bind(std::move(request)); |
| 2492 } | 2503 } |
| 2493 | 2504 |
| 2494 } // namespace content | 2505 } // namespace content |
| OLD | NEW |