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 <vector> | 10 #include <vector> |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 RenderThreadImpl::RenderThreadImpl() | 389 RenderThreadImpl::RenderThreadImpl() |
390 : ChildThread(Options(ShouldUseMojoChannel())) { | 390 : ChildThread(Options(ShouldUseMojoChannel())) { |
391 Init(); | 391 Init(); |
392 } | 392 } |
393 | 393 |
394 RenderThreadImpl::RenderThreadImpl(const std::string& channel_name) | 394 RenderThreadImpl::RenderThreadImpl(const std::string& channel_name) |
395 : ChildThread(Options(channel_name, ShouldUseMojoChannel())) { | 395 : ChildThread(Options(channel_name, ShouldUseMojoChannel())) { |
396 Init(); | 396 Init(); |
397 } | 397 } |
398 | 398 |
399 RenderThreadImpl::RenderThreadImpl( | |
400 scoped_ptr<base::MessageLoop> main_message_loop) | |
401 : ChildThread(Options(ShouldUseMojoChannel())), | |
402 main_message_loop_(main_message_loop.Pass()) { | |
403 Init(); | |
404 } | |
405 | |
406 void RenderThreadImpl::Init() { | 399 void RenderThreadImpl::Init() { |
407 TRACE_EVENT_BEGIN_ETW("RenderThreadImpl::Init", 0, ""); | 400 TRACE_EVENT_BEGIN_ETW("RenderThreadImpl::Init", 0, ""); |
408 | 401 |
409 base::debug::TraceLog::GetInstance()->SetThreadSortIndex( | 402 base::debug::TraceLog::GetInstance()->SetThreadSortIndex( |
410 base::PlatformThread::CurrentId(), | 403 base::PlatformThread::CurrentId(), |
411 kTraceEventRendererMainThreadSortIndex); | 404 kTraceEventRendererMainThreadSortIndex); |
412 | 405 |
413 #if defined(OS_MACOSX) || defined(OS_ANDROID) | 406 #if defined(OS_MACOSX) || defined(OS_ANDROID) |
414 // On Mac and Android, the select popups are rendered by the browser. | 407 // On Mac and Android, the select popups are rendered by the browser. |
415 blink::WebView::setUseExternalPopupMenus(true); | 408 blink::WebView::setUseExternalPopupMenus(true); |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 // EmbeddedWorkerDispatcher. So it must be deleted before deleting | 645 // EmbeddedWorkerDispatcher. So it must be deleted before deleting |
653 // RenderThreadImpl. | 646 // RenderThreadImpl. |
654 embedded_worker_dispatcher_.reset(); | 647 embedded_worker_dispatcher_.reset(); |
655 | 648 |
656 // Ramp down IDB before we ramp down WebKit (and V8), since IDB classes might | 649 // Ramp down IDB before we ramp down WebKit (and V8), since IDB classes might |
657 // hold pointers to V8 objects (e.g., via pending requests). | 650 // hold pointers to V8 objects (e.g., via pending requests). |
658 main_thread_indexed_db_dispatcher_.reset(); | 651 main_thread_indexed_db_dispatcher_.reset(); |
659 | 652 |
660 main_thread_compositor_task_runner_ = NULL; | 653 main_thread_compositor_task_runner_ = NULL; |
661 | 654 |
662 // Shut down the message loop before shutting down Blink. | |
663 // This prevents a scenario where a pending task in the message loop accesses | |
664 // Blink objects after Blink shuts down. | |
665 main_message_loop_.reset(); | |
666 if (webkit_platform_support_) | 655 if (webkit_platform_support_) |
667 blink::shutdown(); | 656 blink::shutdown(); |
668 | 657 |
669 lazy_tls.Pointer()->Set(NULL); | 658 lazy_tls.Pointer()->Set(NULL); |
670 | 659 |
671 // TODO(port) | 660 // TODO(port) |
672 #if defined(OS_WIN) | 661 #if defined(OS_WIN) |
673 // Clean up plugin channels before this thread goes away. | 662 // Clean up plugin channels before this thread goes away. |
674 NPChannelBase::CleanupChannels(); | 663 NPChannelBase::CleanupChannels(); |
675 #endif | 664 #endif |
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1663 hidden_widget_count_--; | 1652 hidden_widget_count_--; |
1664 | 1653 |
1665 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { | 1654 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { |
1666 return; | 1655 return; |
1667 } | 1656 } |
1668 | 1657 |
1669 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 1658 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
1670 } | 1659 } |
1671 | 1660 |
1672 } // namespace content | 1661 } // namespace content |
OLD | NEW |