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 1994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2005 // Return if the world_id is not valid. world_id is passed as a plain int | 2005 // Return if the world_id is not valid. world_id is passed as a plain int |
| 2006 // over IPC and needs to be verified here, in the IPC endpoint. | 2006 // over IPC and needs to be verified here, in the IPC endpoint. |
| 2007 NOTREACHED(); | 2007 NOTREACHED(); |
| 2008 return; | 2008 return; |
| 2009 } | 2009 } |
| 2010 | 2010 |
| 2011 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); | 2011 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); |
| 2012 WebScriptSource script = WebScriptSource(WebString::fromUTF16(jscript)); | 2012 WebScriptSource script = WebScriptSource(WebString::fromUTF16(jscript)); |
| 2013 JavaScriptIsolatedWorldRequest* request = new JavaScriptIsolatedWorldRequest( | 2013 JavaScriptIsolatedWorldRequest* request = new JavaScriptIsolatedWorldRequest( |
| 2014 id, notify_result, routing_id_, weak_factory_.GetWeakPtr()); | 2014 id, notify_result, routing_id_, weak_factory_.GetWeakPtr()); |
| 2015 frame_->requestExecuteScriptInIsolatedWorld(world_id, &script, 1, false, | 2015 frame_->requestExecuteScriptInIsolatedWorld( |
| 2016 request); | 2016 world_id, &script, 1, false, WebLocalFrame::Synchronous, request); |
| 2017 } | 2017 } |
| 2018 | 2018 |
| 2019 RenderFrameImpl::JavaScriptIsolatedWorldRequest::JavaScriptIsolatedWorldRequest( | 2019 RenderFrameImpl::JavaScriptIsolatedWorldRequest::JavaScriptIsolatedWorldRequest( |
| 2020 int id, | 2020 int id, |
| 2021 bool notify_result, | 2021 bool notify_result, |
| 2022 int routing_id, | 2022 int routing_id, |
| 2023 base::WeakPtr<RenderFrameImpl> render_frame_impl) | 2023 base::WeakPtr<RenderFrameImpl> render_frame_impl) |
| 2024 : id_(id), | 2024 : id_(id), |
| 2025 notify_result_(notify_result), | 2025 notify_result_(notify_result), |
| 2026 routing_id_(routing_id), | 2026 routing_id_(routing_id), |
| (...skipping 1875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3902 error.unreachableURL = frame->document().url(); | 3902 error.unreachableURL = frame->document().url(); |
| 3903 error.domain = WebString::fromUTF8(error_domain); | 3903 error.domain = WebString::fromUTF8(error_domain); |
| 3904 error.reason = http_status_code; | 3904 error.reason = http_status_code; |
| 3905 // This call may run scripts, e.g. via the beforeunload event. | 3905 // This call may run scripts, e.g. via the beforeunload event. |
| 3906 LoadNavigationErrorPage(frame->dataSource()->getRequest(), error, true, | 3906 LoadNavigationErrorPage(frame->dataSource()->getRequest(), error, true, |
| 3907 nullptr); | 3907 nullptr); |
| 3908 } | 3908 } |
| 3909 // Do not use |this| or |frame| here without checking |weak_self|. | 3909 // Do not use |this| or |frame| here without checking |weak_self|. |
| 3910 } | 3910 } |
| 3911 | 3911 |
| 3912 void RenderFrameImpl::runScriptsAtDocumentIdle(blink::WebLocalFrame* frame) { | |
| 3913 DCHECK_EQ(frame_, frame); | |
| 3914 base::WeakPtr<RenderFrameImpl> weak_self = weak_factory_.GetWeakPtr(); | |
| 3915 if (!weak_self.get()) | |
| 3916 return; | |
|
kinuko
2017/03/15 12:13:28
How could it be null right after this method is ca
Kunihiko Sakamoto
2017/03/16 07:39:02
Obviously it can't. Removed.
| |
| 3917 | |
| 3918 GetContentClient()->renderer()->RunScriptsAtDocumentIdle(this); | |
| 3919 // ContentClient might have deleted |frame| and |this| by now! | |
| 3920 } | |
| 3921 | |
| 3912 void RenderFrameImpl::didHandleOnloadEvents(blink::WebLocalFrame* frame) { | 3922 void RenderFrameImpl::didHandleOnloadEvents(blink::WebLocalFrame* frame) { |
| 3913 DCHECK_EQ(frame_, frame); | 3923 DCHECK_EQ(frame_, frame); |
| 3914 if (!frame->parent()) { | 3924 if (!frame->parent()) { |
| 3915 FrameMsg_UILoadMetricsReportType::Value report_type = | 3925 FrameMsg_UILoadMetricsReportType::Value report_type = |
| 3916 static_cast<FrameMsg_UILoadMetricsReportType::Value>( | 3926 static_cast<FrameMsg_UILoadMetricsReportType::Value>( |
| 3917 frame->dataSource()->getRequest().inputPerfMetricReportPolicy()); | 3927 frame->dataSource()->getRequest().inputPerfMetricReportPolicy()); |
| 3918 base::TimeTicks ui_timestamp = | 3928 base::TimeTicks ui_timestamp = |
| 3919 base::TimeTicks() + | 3929 base::TimeTicks() + |
| 3920 base::TimeDelta::FromSecondsD( | 3930 base::TimeDelta::FromSecondsD( |
| 3921 frame->dataSource()->getRequest().uiStartTime()); | 3931 frame->dataSource()->getRequest().uiStartTime()); |
| (...skipping 2967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6889 // event target. Potentially a Pepper plugin will receive the event. | 6899 // event target. Potentially a Pepper plugin will receive the event. |
| 6890 // In order to tell whether a plugin gets the last mouse event and which it | 6900 // In order to tell whether a plugin gets the last mouse event and which it |
| 6891 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6901 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6892 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6902 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6893 // |pepper_last_mouse_event_target_|. | 6903 // |pepper_last_mouse_event_target_|. |
| 6894 pepper_last_mouse_event_target_ = nullptr; | 6904 pepper_last_mouse_event_target_ = nullptr; |
| 6895 #endif | 6905 #endif |
| 6896 } | 6906 } |
| 6897 | 6907 |
| 6898 } // namespace content | 6908 } // namespace content |
| OLD | NEW |