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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 1142123002: Remove swapped-out usage in --site-per-process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix DisownOpener. Created 5 years, 6 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 (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_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 next_page_id_(params.next_page_id), 631 next_page_id_(params.next_page_id),
632 history_list_offset_(-1), 632 history_list_offset_(-1),
633 history_list_length_(0), 633 history_list_length_(0),
634 frames_in_progress_(0), 634 frames_in_progress_(0),
635 target_url_status_(TARGET_NONE), 635 target_url_status_(TARGET_NONE),
636 uses_temporary_zoom_level_(false), 636 uses_temporary_zoom_level_(false),
637 #if defined(OS_ANDROID) 637 #if defined(OS_ANDROID)
638 top_controls_constraints_(TOP_CONTROLS_STATE_BOTH), 638 top_controls_constraints_(TOP_CONTROLS_STATE_BOTH),
639 #endif 639 #endif
640 has_scrolled_focused_editable_node_into_rect_(false), 640 has_scrolled_focused_editable_node_into_rect_(false),
641 main_render_frame_(nullptr),
641 speech_recognition_dispatcher_(NULL), 642 speech_recognition_dispatcher_(NULL),
642 mouse_lock_dispatcher_(NULL), 643 mouse_lock_dispatcher_(NULL),
643 #if defined(OS_ANDROID) 644 #if defined(OS_ANDROID)
644 expected_content_intent_id_(0), 645 expected_content_intent_id_(0),
645 #endif 646 #endif
646 #if defined(OS_WIN) 647 #if defined(OS_WIN)
647 focused_plugin_id_(-1), 648 focused_plugin_id_(-1),
648 #endif 649 #endif
649 #if defined(ENABLE_PLUGINS) 650 #if defined(ENABLE_PLUGINS)
650 plugin_find_handler_(NULL), 651 plugin_find_handler_(NULL),
(...skipping 10 matching lines...) Expand all
661 bool was_created_by_renderer) { 662 bool was_created_by_renderer) {
662 routing_id_ = params.view_id; 663 routing_id_ = params.view_id;
663 surface_id_ = params.surface_id; 664 surface_id_ = params.surface_id;
664 if (params.opener_route_id != MSG_ROUTING_NONE && was_created_by_renderer) 665 if (params.opener_route_id != MSG_ROUTING_NONE && was_created_by_renderer)
665 opener_id_ = params.opener_route_id; 666 opener_id_ = params.opener_route_id;
666 display_mode_= params.initial_size.display_mode; 667 display_mode_= params.initial_size.display_mode;
667 668
668 // Ensure we start with a valid next_page_id_ from the browser. 669 // Ensure we start with a valid next_page_id_ from the browser.
669 DCHECK_GE(next_page_id_, 0); 670 DCHECK_GE(next_page_id_, 0);
670 671
671 main_render_frame_ = RenderFrameImpl::Create( 672 if (params.main_frame_routing_id != MSG_ROUTING_NONE) {
672 this, params.main_frame_routing_id); 673 main_render_frame_ = RenderFrameImpl::Create(
673 // The main frame WebLocalFrame object is closed by 674 this, params.main_frame_routing_id);
674 // RenderFrameImpl::frameDetached(). 675 // The main frame WebLocalFrame object is closed by
675 WebLocalFrame* web_frame = WebLocalFrame::create( 676 // RenderFrameImpl::frameDetached().
676 blink::WebTreeScopeType::Document, main_render_frame_); 677 WebLocalFrame* web_frame = WebLocalFrame::create(
677 main_render_frame_->SetWebFrame(web_frame); 678 blink::WebTreeScopeType::Document, main_render_frame_);
679 main_render_frame_->SetWebFrame(web_frame);
680 }
678 681
679 compositor_deps_ = compositor_deps; 682 compositor_deps_ = compositor_deps;
680 webwidget_ = WebView::create(this); 683 webwidget_ = WebView::create(this);
681 webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_)); 684 webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_));
682 685
686 g_view_map.Get().insert(std::make_pair(webview(), this));
687 g_routing_id_view_map.Get().insert(std::make_pair(routing_id_, this));
Charlie Reis 2015/06/04 00:02:11 Why did you need to move this up?
nasko 2015/06/04 14:57:14 I want to ensure that any code that does discovery
688
683 const base::CommandLine& command_line = 689 const base::CommandLine& command_line =
684 *base::CommandLine::ForCurrentProcess(); 690 *base::CommandLine::ForCurrentProcess();
685 691
686 if (command_line.HasSwitch(switches::kStatsCollectionController)) 692 if (command_line.HasSwitch(switches::kStatsCollectionController))
687 stats_collection_observer_.reset(new StatsCollectionObserver(this)); 693 stats_collection_observer_.reset(new StatsCollectionObserver(this));
688 694
695 RenderFrameProxy* proxy = NULL;
696 if (params.proxy_routing_id != MSG_ROUTING_NONE) {
697 CHECK(params.swapped_out);
698 if (main_render_frame_) {
699 proxy = RenderFrameProxy::CreateProxyToReplaceFrame(
700 main_render_frame_, params.proxy_routing_id,
701 blink::WebTreeScopeType::Document);
702 main_render_frame_->set_render_frame_proxy(proxy);
703 } else {
704 proxy = RenderFrameProxy::CreateFrameProxy(
705 params.proxy_routing_id,
706 MSG_ROUTING_NONE,
707 routing_id_,
708 params.replicated_frame_state);
709 }
710 }
711
712 // In --site-per-process, just use the WebRemoteFrame as the main frame.
713 if (command_line.HasSwitch(switches::kSitePerProcess) && proxy) {
714 webview()->setMainFrame(proxy->web_frame());
715 // Initialize the WebRemoteFrame with information replicated from the
716 // browser process.
717 proxy->SetReplicatedState(params.replicated_frame_state);
718 } else {
719 webview()->setMainFrame(main_render_frame_->GetWebFrame());
720 }
721 if (main_render_frame_)
722 main_render_frame_->Initialize();
723
689 #if defined(OS_ANDROID) 724 #if defined(OS_ANDROID)
690 content_detectors_.push_back(linked_ptr<ContentDetector>( 725 content_detectors_.push_back(linked_ptr<ContentDetector>(
691 new AddressDetector())); 726 new AddressDetector()));
692 const std::string& contry_iso = 727 const std::string& contry_iso =
693 params.renderer_preferences.network_contry_iso; 728 params.renderer_preferences.network_contry_iso;
694 if (!contry_iso.empty()) { 729 if (!contry_iso.empty()) {
695 content_detectors_.push_back(linked_ptr<ContentDetector>( 730 content_detectors_.push_back(linked_ptr<ContentDetector>(
696 new PhoneNumberDetector(contry_iso))); 731 new PhoneNumberDetector(contry_iso)));
697 } 732 }
698 content_detectors_.push_back(linked_ptr<ContentDetector>( 733 content_detectors_.push_back(linked_ptr<ContentDetector>(
(...skipping 11 matching lines...) Expand all
710 RenderThreadImpl::current()->WidgetHidden(); 745 RenderThreadImpl::current()->WidgetHidden();
711 } 746 }
712 747
713 // If this is a popup, we must wait for the CreatingNew_ACK message before 748 // If this is a popup, we must wait for the CreatingNew_ACK message before
714 // completing initialization. Otherwise, we can finish it now. 749 // completing initialization. Otherwise, we can finish it now.
715 if (opener_id_ == MSG_ROUTING_NONE) { 750 if (opener_id_ == MSG_ROUTING_NONE) {
716 did_show_ = true; 751 did_show_ = true;
717 CompleteInit(); 752 CompleteInit();
718 } 753 }
719 754
720 g_view_map.Get().insert(std::make_pair(webview(), this));
721 g_routing_id_view_map.Get().insert(std::make_pair(routing_id_, this));
722 webview()->setDeviceScaleFactor(device_scale_factor_); 755 webview()->setDeviceScaleFactor(device_scale_factor_);
723 webview()->setDisplayMode(display_mode_); 756 webview()->setDisplayMode(display_mode_);
724 webview()->settings()->setPreferCompositingToLCDTextEnabled( 757 webview()->settings()->setPreferCompositingToLCDTextEnabled(
725 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); 758 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_));
726 webview()->settings()->setThreadedScrollingEnabled( 759 webview()->settings()->setThreadedScrollingEnabled(
727 !command_line.HasSwitch(switches::kDisableThreadedScrolling)); 760 !command_line.HasSwitch(switches::kDisableThreadedScrolling));
728 webview()->settings()->setRootLayerScrolls( 761 webview()->settings()->setRootLayerScrolls(
729 command_line.HasSwitch(switches::kRootLayerScrolls)); 762 command_line.HasSwitch(switches::kRootLayerScrolls));
730 763
731 ApplyWebPreferences(webkit_preferences_, webview()); 764 ApplyWebPreferences(webkit_preferences_, webview());
732 765
733 RenderFrameProxy* proxy = NULL;
734 if (params.proxy_routing_id != MSG_ROUTING_NONE) {
735 CHECK(params.swapped_out);
736 proxy = RenderFrameProxy::CreateProxyToReplaceFrame(
737 main_render_frame_, params.proxy_routing_id,
738 blink::WebTreeScopeType::Document);
739 main_render_frame_->set_render_frame_proxy(proxy);
740 }
741
742 // In --site-per-process, just use the WebRemoteFrame as the main frame.
743 if (command_line.HasSwitch(switches::kSitePerProcess) && proxy) {
744 webview()->setMainFrame(proxy->web_frame());
745 // Initialize the WebRemoteFrame with information replicated from the
746 // browser process.
747 proxy->SetReplicatedState(params.replicated_frame_state);
748 } else {
749 webview()->setMainFrame(main_render_frame_->GetWebFrame());
750 }
751 main_render_frame_->Initialize();
752
pgorszkowski 2015/09/14 13:26:10 Moving this part before ApplyWebPreferences causes
753 if (switches::IsTouchDragDropEnabled()) 766 if (switches::IsTouchDragDropEnabled())
754 webview()->settings()->setTouchDragDropEnabled(true); 767 webview()->settings()->setTouchDragDropEnabled(true);
755 768
756 if (switches::IsTouchEditingEnabled()) 769 if (switches::IsTouchEditingEnabled())
757 webview()->settings()->setTouchEditingEnabled(true); 770 webview()->settings()->setTouchEditingEnabled(true);
758 771
759 WebSettings::SelectionStrategyType selection_strategy = 772 WebSettings::SelectionStrategyType selection_strategy =
760 WebSettings::SelectionStrategyType::Character; 773 WebSettings::SelectionStrategyType::Character;
761 const std::string selection_strategy_str = 774 const std::string selection_strategy_str =
762 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 775 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
(...skipping 3004 matching lines...) Expand 10 before | Expand all | Expand 10 after
3767 std::vector<gfx::Size> sizes; 3780 std::vector<gfx::Size> sizes;
3768 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 3781 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
3769 if (!url.isEmpty()) 3782 if (!url.isEmpty())
3770 urls.push_back( 3783 urls.push_back(
3771 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 3784 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
3772 } 3785 }
3773 SendUpdateFaviconURL(urls); 3786 SendUpdateFaviconURL(urls);
3774 } 3787 }
3775 3788
3776 } // namespace content 3789 } // namespace content
OLDNEW
« content/renderer/render_frame_impl.cc ('K') | « content/renderer/render_view_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698