| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 28 matching lines...) Expand all Loading... |
| 39 #include "content/renderer/devtools_agent_filter.h" | 39 #include "content/renderer/devtools_agent_filter.h" |
| 40 #include "content/renderer/gpu/compositor_thread.h" | 40 #include "content/renderer/gpu/compositor_thread.h" |
| 41 #include "content/renderer/gpu/gpu_channel_host.h" | 41 #include "content/renderer/gpu/gpu_channel_host.h" |
| 42 #include "content/renderer/indexed_db_dispatcher.h" | 42 #include "content/renderer/indexed_db_dispatcher.h" |
| 43 #include "content/renderer/media/audio_input_message_filter.h" | 43 #include "content/renderer/media/audio_input_message_filter.h" |
| 44 #include "content/renderer/media/audio_message_filter.h" | 44 #include "content/renderer/media/audio_message_filter.h" |
| 45 #include "content/renderer/media/video_capture_impl_manager.h" | 45 #include "content/renderer/media/video_capture_impl_manager.h" |
| 46 #include "content/renderer/media/video_capture_message_filter.h" | 46 #include "content/renderer/media/video_capture_message_filter.h" |
| 47 #include "content/renderer/plugin_channel_host.h" | 47 #include "content/renderer/plugin_channel_host.h" |
| 48 #include "content/renderer/render_process_impl.h" | 48 #include "content/renderer/render_process_impl.h" |
| 49 #include "content/renderer/render_view.h" | 49 #include "content/renderer/render_view_impl.h" |
| 50 #include "content/renderer/renderer_webidbfactory_impl.h" | 50 #include "content/renderer/renderer_webidbfactory_impl.h" |
| 51 #include "content/renderer/renderer_webkitplatformsupport_impl.h" | 51 #include "content/renderer/renderer_webkitplatformsupport_impl.h" |
| 52 #include "ipc/ipc_channel_handle.h" | 52 #include "ipc/ipc_channel_handle.h" |
| 53 #include "ipc/ipc_platform_file.h" | 53 #include "ipc/ipc_platform_file.h" |
| 54 #include "net/base/net_errors.h" | 54 #include "net/base/net_errors.h" |
| 55 #include "net/base/net_util.h" | 55 #include "net/base/net_util.h" |
| 56 #include "third_party/tcmalloc/chromium/src/google/malloc_extension.h" | 56 #include "third_party/tcmalloc/chromium/src/google/malloc_extension.h" |
| 57 #include "third_party/WebKit/Source/WebKit/chromium/public/WebColor.h" | 57 #include "third_party/WebKit/Source/WebKit/chromium/public/WebColor.h" |
| 58 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDatabase.h" | 58 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDatabase.h" |
| 59 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 59 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 Send(new ChildProcessHostMsg_ReleaseCachedFonts()); | 583 Send(new ChildProcessHostMsg_ReleaseCachedFonts()); |
| 584 } | 584 } |
| 585 | 585 |
| 586 #endif // OS_WIN | 586 #endif // OS_WIN |
| 587 | 587 |
| 588 int32 RenderThreadImpl::RoutingIDForCurrentContext() { | 588 int32 RenderThreadImpl::RoutingIDForCurrentContext() { |
| 589 int32 routing_id = MSG_ROUTING_CONTROL; | 589 int32 routing_id = MSG_ROUTING_CONTROL; |
| 590 if (v8::Context::InContext()) { | 590 if (v8::Context::InContext()) { |
| 591 WebFrame* frame = WebFrame::frameForCurrentContext(); | 591 WebFrame* frame = WebFrame::frameForCurrentContext(); |
| 592 if (frame) { | 592 if (frame) { |
| 593 RenderView* view = RenderView::FromWebView(frame->view()); | 593 RenderViewImpl* view = RenderViewImpl::FromWebView(frame->view()); |
| 594 if (view) | 594 if (view) |
| 595 routing_id = view->routing_id(); | 595 routing_id = view->routing_id(); |
| 596 } | 596 } |
| 597 } else { | 597 } else { |
| 598 DLOG(WARNING) << "Not called within a script context!"; | 598 DLOG(WARNING) << "Not called within a script context!"; |
| 599 } | 599 } |
| 600 return routing_id; | 600 return routing_id; |
| 601 } | 601 } |
| 602 | 602 |
| 603 void RenderThreadImpl::DoNotSuspendWebKitSharedTimer() { | 603 void RenderThreadImpl::DoNotSuspendWebKitSharedTimer() { |
| 604 suspend_webkit_shared_timer_ = false; | 604 suspend_webkit_shared_timer_ = false; |
| 605 } | 605 } |
| 606 | 606 |
| 607 void RenderThreadImpl::DoNotNotifyWebKitOfModalLoop() { | 607 void RenderThreadImpl::DoNotNotifyWebKitOfModalLoop() { |
| 608 notify_webkit_of_modal_loop_ = false; | 608 notify_webkit_of_modal_loop_ = false; |
| 609 } | 609 } |
| 610 | 610 |
| 611 void RenderThreadImpl::OnSetZoomLevelForCurrentURL(const GURL& url, | 611 void RenderThreadImpl::OnSetZoomLevelForCurrentURL(const GURL& url, |
| 612 double zoom_level) { | 612 double zoom_level) { |
| 613 RenderViewZoomer zoomer(url, zoom_level); | 613 RenderViewZoomer zoomer(url, zoom_level); |
| 614 RenderView::ForEach(&zoomer); | 614 content::RenderView::ForEach(&zoomer); |
| 615 } | 615 } |
| 616 | 616 |
| 617 void RenderThreadImpl::OnDOMStorageEvent( | 617 void RenderThreadImpl::OnDOMStorageEvent( |
| 618 const DOMStorageMsg_Event_Params& params) { | 618 const DOMStorageMsg_Event_Params& params) { |
| 619 if (!dom_storage_event_dispatcher_.get()) | 619 if (!dom_storage_event_dispatcher_.get()) |
| 620 dom_storage_event_dispatcher_.reset(WebStorageEventDispatcher::create()); | 620 dom_storage_event_dispatcher_.reset(WebStorageEventDispatcher::create()); |
| 621 dom_storage_event_dispatcher_->dispatchStorageEvent(params.key, | 621 dom_storage_event_dispatcher_->dispatchStorageEvent(params.key, |
| 622 params.old_value, params.new_value, params.origin, params.url, | 622 params.old_value, params.new_value, params.origin, params.url, |
| 623 params.storage_type == DOM_STORAGE_LOCAL); | 623 params.storage_type == DOM_STORAGE_LOCAL); |
| 624 } | 624 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 650 IPC_MESSAGE_HANDLER(ViewMsg_NetworkStateChanged, OnNetworkStateChanged) | 650 IPC_MESSAGE_HANDLER(ViewMsg_NetworkStateChanged, OnNetworkStateChanged) |
| 651 IPC_MESSAGE_HANDLER(DOMStorageMsg_Event, OnDOMStorageEvent) | 651 IPC_MESSAGE_HANDLER(DOMStorageMsg_Event, OnDOMStorageEvent) |
| 652 IPC_MESSAGE_UNHANDLED(handled = false) | 652 IPC_MESSAGE_UNHANDLED(handled = false) |
| 653 IPC_END_MESSAGE_MAP() | 653 IPC_END_MESSAGE_MAP() |
| 654 return handled; | 654 return handled; |
| 655 } | 655 } |
| 656 | 656 |
| 657 void RenderThreadImpl::OnSetNextPageID(int32 next_page_id) { | 657 void RenderThreadImpl::OnSetNextPageID(int32 next_page_id) { |
| 658 // This should only be called at process initialization time, so we shouldn't | 658 // This should only be called at process initialization time, so we shouldn't |
| 659 // have to worry about thread-safety. | 659 // have to worry about thread-safety. |
| 660 RenderView::SetNextPageID(next_page_id); | 660 RenderViewImpl::SetNextPageID(next_page_id); |
| 661 } | 661 } |
| 662 | 662 |
| 663 // Called when to register CSS Color name->system color mappings. | 663 // Called when to register CSS Color name->system color mappings. |
| 664 // We update the colors one by one and then tell WebKit to refresh all render | 664 // We update the colors one by one and then tell WebKit to refresh all render |
| 665 // views. | 665 // views. |
| 666 void RenderThreadImpl::OnSetCSSColors( | 666 void RenderThreadImpl::OnSetCSSColors( |
| 667 const std::vector<CSSColors::CSSColorMapping>& colors) { | 667 const std::vector<CSSColors::CSSColorMapping>& colors) { |
| 668 EnsureWebKitInitialized(); | 668 EnsureWebKitInitialized(); |
| 669 size_t num_colors = colors.size(); | 669 size_t num_colors = colors.size(); |
| 670 scoped_array<WebKit::WebColorName> color_names( | 670 scoped_array<WebKit::WebColorName> color_names( |
| 671 new WebKit::WebColorName[num_colors]); | 671 new WebKit::WebColorName[num_colors]); |
| 672 scoped_array<WebKit::WebColor> web_colors(new WebKit::WebColor[num_colors]); | 672 scoped_array<WebKit::WebColor> web_colors(new WebKit::WebColor[num_colors]); |
| 673 size_t i = 0; | 673 size_t i = 0; |
| 674 for (std::vector<CSSColors::CSSColorMapping>::const_iterator it = | 674 for (std::vector<CSSColors::CSSColorMapping>::const_iterator it = |
| 675 colors.begin(); | 675 colors.begin(); |
| 676 it != colors.end(); | 676 it != colors.end(); |
| 677 ++it, ++i) { | 677 ++it, ++i) { |
| 678 color_names[i] = it->first; | 678 color_names[i] = it->first; |
| 679 web_colors[i] = it->second; | 679 web_colors[i] = it->second; |
| 680 } | 680 } |
| 681 WebKit::setNamedColors(color_names.get(), web_colors.get(), num_colors); | 681 WebKit::setNamedColors(color_names.get(), web_colors.get(), num_colors); |
| 682 } | 682 } |
| 683 | 683 |
| 684 void RenderThreadImpl::OnCreateNewView(const ViewMsg_New_Params& params) { | 684 void RenderThreadImpl::OnCreateNewView(const ViewMsg_New_Params& params) { |
| 685 EnsureWebKitInitialized(); | 685 EnsureWebKitInitialized(); |
| 686 // When bringing in render_view, also bring in webkit's glue and jsbindings. | 686 // When bringing in render_view, also bring in webkit's glue and jsbindings. |
| 687 RenderView::Create( | 687 RenderViewImpl::Create( |
| 688 params.parent_window, | 688 params.parent_window, |
| 689 MSG_ROUTING_NONE, | 689 MSG_ROUTING_NONE, |
| 690 params.renderer_preferences, | 690 params.renderer_preferences, |
| 691 params.web_preferences, | 691 params.web_preferences, |
| 692 new SharedRenderViewCounter(0), | 692 new SharedRenderViewCounter(0), |
| 693 params.view_id, | 693 params.view_id, |
| 694 params.session_storage_namespace_id, | 694 params.session_storage_namespace_id, |
| 695 params.frame_name); | 695 params.frame_name); |
| 696 } | 696 } |
| 697 | 697 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 | 764 |
| 765 scoped_refptr<base::MessageLoopProxy> | 765 scoped_refptr<base::MessageLoopProxy> |
| 766 RenderThreadImpl::GetFileThreadMessageLoopProxy() { | 766 RenderThreadImpl::GetFileThreadMessageLoopProxy() { |
| 767 DCHECK(message_loop() == MessageLoop::current()); | 767 DCHECK(message_loop() == MessageLoop::current()); |
| 768 if (!file_thread_.get()) { | 768 if (!file_thread_.get()) { |
| 769 file_thread_.reset(new base::Thread("Renderer::FILE")); | 769 file_thread_.reset(new base::Thread("Renderer::FILE")); |
| 770 file_thread_->Start(); | 770 file_thread_->Start(); |
| 771 } | 771 } |
| 772 return file_thread_->message_loop_proxy(); | 772 return file_thread_->message_loop_proxy(); |
| 773 } | 773 } |
| OLD | NEW |