Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1973 // Return if the world_id is not valid. world_id is passed as a plain int | 1973 // Return if the world_id is not valid. world_id is passed as a plain int |
| 1974 // over IPC and needs to be verified here, in the IPC endpoint. | 1974 // over IPC and needs to be verified here, in the IPC endpoint. |
| 1975 NOTREACHED(); | 1975 NOTREACHED(); |
| 1976 return; | 1976 return; |
| 1977 } | 1977 } |
| 1978 | 1978 |
| 1979 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); | 1979 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); |
| 1980 WebScriptSource script = WebScriptSource(WebString::fromUTF16(jscript)); | 1980 WebScriptSource script = WebScriptSource(WebString::fromUTF16(jscript)); |
| 1981 JavaScriptIsolatedWorldRequest* request = new JavaScriptIsolatedWorldRequest( | 1981 JavaScriptIsolatedWorldRequest* request = new JavaScriptIsolatedWorldRequest( |
| 1982 id, notify_result, routing_id_, weak_factory_.GetWeakPtr()); | 1982 id, notify_result, routing_id_, weak_factory_.GetWeakPtr()); |
| 1983 frame_->requestExecuteScriptInIsolatedWorld(world_id, &script, 1, false, | 1983 frame_->requestExecuteScriptInIsolatedWorld( |
| 1984 request); | 1984 world_id, &script, 1, false, WebLocalFrame::Synchronous, request); |
| 1985 } | 1985 } |
| 1986 | 1986 |
| 1987 RenderFrameImpl::JavaScriptIsolatedWorldRequest::JavaScriptIsolatedWorldRequest( | 1987 RenderFrameImpl::JavaScriptIsolatedWorldRequest::JavaScriptIsolatedWorldRequest( |
| 1988 int id, | 1988 int id, |
| 1989 bool notify_result, | 1989 bool notify_result, |
| 1990 int routing_id, | 1990 int routing_id, |
| 1991 base::WeakPtr<RenderFrameImpl> render_frame_impl) | 1991 base::WeakPtr<RenderFrameImpl> render_frame_impl) |
| 1992 : id_(id), | 1992 : id_(id), |
| 1993 notify_result_(notify_result), | 1993 notify_result_(notify_result), |
| 1994 routing_id_(routing_id), | 1994 routing_id_(routing_id), |
| (...skipping 1859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3854 error.unreachableURL = frame->document().url(); | 3854 error.unreachableURL = frame->document().url(); |
| 3855 error.domain = WebString::fromUTF8(error_domain); | 3855 error.domain = WebString::fromUTF8(error_domain); |
| 3856 error.reason = http_status_code; | 3856 error.reason = http_status_code; |
| 3857 // This call may run scripts, e.g. via the beforeunload event. | 3857 // This call may run scripts, e.g. via the beforeunload event. |
| 3858 LoadNavigationErrorPage(frame->dataSource()->getRequest(), error, true, | 3858 LoadNavigationErrorPage(frame->dataSource()->getRequest(), error, true, |
| 3859 nullptr); | 3859 nullptr); |
| 3860 } | 3860 } |
| 3861 // Do not use |this| or |frame| here without checking |weak_self|. | 3861 // Do not use |this| or |frame| here without checking |weak_self|. |
| 3862 } | 3862 } |
| 3863 | 3863 |
| 3864 void RenderFrameImpl::runScriptsAtDocumentIdle(blink::WebLocalFrame* frame) { | |
| 3865 DCHECK_EQ(frame_, frame); | |
| 3866 base::WeakPtr<RenderFrameImpl> weak_self = weak_factory_.GetWeakPtr(); | |
| 3867 if (!weak_self.get()) | |
| 3868 return; | |
| 3869 | |
| 3870 GetContentClient()->renderer()->RunScriptsAtDocumentIdle(this); | |
|
Devlin
2017/02/21 18:56:26
Probably worth adding a comment that |frame| and |
Kunihiko Sakamoto
2017/02/23 09:49:01
Done.
| |
| 3871 } | |
| 3872 | |
| 3864 void RenderFrameImpl::didHandleOnloadEvents(blink::WebLocalFrame* frame) { | 3873 void RenderFrameImpl::didHandleOnloadEvents(blink::WebLocalFrame* frame) { |
| 3865 DCHECK_EQ(frame_, frame); | 3874 DCHECK_EQ(frame_, frame); |
| 3866 if (!frame->parent()) { | 3875 if (!frame->parent()) { |
| 3867 FrameMsg_UILoadMetricsReportType::Value report_type = | 3876 FrameMsg_UILoadMetricsReportType::Value report_type = |
| 3868 static_cast<FrameMsg_UILoadMetricsReportType::Value>( | 3877 static_cast<FrameMsg_UILoadMetricsReportType::Value>( |
| 3869 frame->dataSource()->getRequest().inputPerfMetricReportPolicy()); | 3878 frame->dataSource()->getRequest().inputPerfMetricReportPolicy()); |
| 3870 base::TimeTicks ui_timestamp = | 3879 base::TimeTicks ui_timestamp = |
| 3871 base::TimeTicks() + | 3880 base::TimeTicks() + |
| 3872 base::TimeDelta::FromSecondsD( | 3881 base::TimeDelta::FromSecondsD( |
| 3873 frame->dataSource()->getRequest().uiStartTime()); | 3882 frame->dataSource()->getRequest().uiStartTime()); |
| (...skipping 2954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6828 // event target. Potentially a Pepper plugin will receive the event. | 6837 // event target. Potentially a Pepper plugin will receive the event. |
| 6829 // In order to tell whether a plugin gets the last mouse event and which it | 6838 // In order to tell whether a plugin gets the last mouse event and which it |
| 6830 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6839 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6831 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6840 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6832 // |pepper_last_mouse_event_target_|. | 6841 // |pepper_last_mouse_event_target_|. |
| 6833 pepper_last_mouse_event_target_ = nullptr; | 6842 pepper_last_mouse_event_target_ = nullptr; |
| 6834 #endif | 6843 #endif |
| 6835 } | 6844 } |
| 6836 | 6845 |
| 6837 } // namespace content | 6846 } // namespace content |
| OLD | NEW |