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

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

Issue 2633253002: Split content script injections into multiple tasks (Closed)
Patch Set: rebase Created 3 years, 9 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 1979 matching lines...) Expand 10 before | Expand all | Expand 10 after
1990 // Return if the world_id is not valid. world_id is passed as a plain int 1990 // Return if the world_id is not valid. world_id is passed as a plain int
1991 // over IPC and needs to be verified here, in the IPC endpoint. 1991 // over IPC and needs to be verified here, in the IPC endpoint.
1992 NOTREACHED(); 1992 NOTREACHED();
1993 return; 1993 return;
1994 } 1994 }
1995 1995
1996 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); 1996 v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
1997 WebScriptSource script = WebScriptSource(WebString::fromUTF16(jscript)); 1997 WebScriptSource script = WebScriptSource(WebString::fromUTF16(jscript));
1998 JavaScriptIsolatedWorldRequest* request = new JavaScriptIsolatedWorldRequest( 1998 JavaScriptIsolatedWorldRequest* request = new JavaScriptIsolatedWorldRequest(
1999 id, notify_result, routing_id_, weak_factory_.GetWeakPtr()); 1999 id, notify_result, routing_id_, weak_factory_.GetWeakPtr());
2000 frame_->requestExecuteScriptInIsolatedWorld(world_id, &script, 1, false, 2000 frame_->requestExecuteScriptInIsolatedWorld(
2001 request); 2001 world_id, &script, 1, false, WebLocalFrame::Synchronous, request);
2002 } 2002 }
2003 2003
2004 RenderFrameImpl::JavaScriptIsolatedWorldRequest::JavaScriptIsolatedWorldRequest( 2004 RenderFrameImpl::JavaScriptIsolatedWorldRequest::JavaScriptIsolatedWorldRequest(
2005 int id, 2005 int id,
2006 bool notify_result, 2006 bool notify_result,
2007 int routing_id, 2007 int routing_id,
2008 base::WeakPtr<RenderFrameImpl> render_frame_impl) 2008 base::WeakPtr<RenderFrameImpl> render_frame_impl)
2009 : id_(id), 2009 : id_(id),
2010 notify_result_(notify_result), 2010 notify_result_(notify_result),
2011 routing_id_(routing_id), 2011 routing_id_(routing_id),
(...skipping 1831 matching lines...) Expand 10 before | Expand all | Expand 10 after
3843 error.unreachableURL = frame->document().url(); 3843 error.unreachableURL = frame->document().url();
3844 error.domain = WebString::fromUTF8(error_domain); 3844 error.domain = WebString::fromUTF8(error_domain);
3845 error.reason = http_status_code; 3845 error.reason = http_status_code;
3846 // This call may run scripts, e.g. via the beforeunload event. 3846 // This call may run scripts, e.g. via the beforeunload event.
3847 LoadNavigationErrorPage(frame->dataSource()->getRequest(), error, true, 3847 LoadNavigationErrorPage(frame->dataSource()->getRequest(), error, true,
3848 nullptr); 3848 nullptr);
3849 } 3849 }
3850 // Do not use |this| or |frame| here without checking |weak_self|. 3850 // Do not use |this| or |frame| here without checking |weak_self|.
3851 } 3851 }
3852 3852
3853 void RenderFrameImpl::runScriptsAtDocumentIdle(blink::WebLocalFrame* frame) {
3854 DCHECK_EQ(frame_, frame);
3855 base::WeakPtr<RenderFrameImpl> weak_self = weak_factory_.GetWeakPtr();
3856 if (!weak_self.get())
3857 return;
3858
3859 GetContentClient()->renderer()->RunScriptsAtDocumentIdle(this);
3860 // ContentClient might have deleted |frame| and |this| by now!
3861 }
3862
3853 void RenderFrameImpl::didHandleOnloadEvents(blink::WebLocalFrame* frame) { 3863 void RenderFrameImpl::didHandleOnloadEvents(blink::WebLocalFrame* frame) {
3854 DCHECK_EQ(frame_, frame); 3864 DCHECK_EQ(frame_, frame);
3855 if (!frame->parent()) { 3865 if (!frame->parent()) {
3856 FrameMsg_UILoadMetricsReportType::Value report_type = 3866 FrameMsg_UILoadMetricsReportType::Value report_type =
3857 static_cast<FrameMsg_UILoadMetricsReportType::Value>( 3867 static_cast<FrameMsg_UILoadMetricsReportType::Value>(
3858 frame->dataSource()->getRequest().inputPerfMetricReportPolicy()); 3868 frame->dataSource()->getRequest().inputPerfMetricReportPolicy());
3859 base::TimeTicks ui_timestamp = 3869 base::TimeTicks ui_timestamp =
3860 base::TimeTicks() + 3870 base::TimeTicks() +
3861 base::TimeDelta::FromSecondsD( 3871 base::TimeDelta::FromSecondsD(
3862 frame->dataSource()->getRequest().uiStartTime()); 3872 frame->dataSource()->getRequest().uiStartTime());
(...skipping 2978 matching lines...) Expand 10 before | Expand all | Expand 10 after
6841 // event target. Potentially a Pepper plugin will receive the event. 6851 // event target. Potentially a Pepper plugin will receive the event.
6842 // In order to tell whether a plugin gets the last mouse event and which it 6852 // In order to tell whether a plugin gets the last mouse event and which it
6843 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6853 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6844 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6854 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6845 // |pepper_last_mouse_event_target_|. 6855 // |pepper_last_mouse_event_target_|.
6846 pepper_last_mouse_event_target_ = nullptr; 6856 pepper_last_mouse_event_target_ = nullptr;
6847 #endif 6857 #endif
6848 } 6858 }
6849 6859
6850 } // namespace content 6860 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698