OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
5 * (http://www.torchmobile.com/) | 5 * (http://www.torchmobile.com/) |
6 * Copyright (C) 2009 Adam Barth. All rights reserved. | 6 * Copyright (C) 2009 Adam Barth. All rights reserved. |
7 * | 7 * |
8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
10 * are met: | 10 * are met: |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
251 bool replacesCurrentItem) | 251 bool replacesCurrentItem) |
252 : ScheduledURLNavigation(0.0, | 252 : ScheduledURLNavigation(0.0, |
253 originDocument, | 253 originDocument, |
254 url, | 254 url, |
255 replacesCurrentItem, | 255 replacesCurrentItem, |
256 !protocolIsJavaScript(url)) {} | 256 !protocolIsJavaScript(url)) {} |
257 }; | 257 }; |
258 | 258 |
259 class ScheduledReload final : public ScheduledNavigation { | 259 class ScheduledReload final : public ScheduledNavigation { |
260 public: | 260 public: |
261 static ScheduledReload* create() { return new ScheduledReload; } | 261 static ScheduledReload* create(FrameLoadType type) { |
262 DCHECK(isReloadLoadType(type)); | |
263 return new ScheduledReload(type); | |
264 } | |
262 | 265 |
263 void fire(LocalFrame* frame) override { | 266 void fire(LocalFrame* frame) override { |
264 std::unique_ptr<UserGestureIndicator> gestureIndicator = | 267 std::unique_ptr<UserGestureIndicator> gestureIndicator = |
265 createUserGestureIndicator(); | 268 createUserGestureIndicator(); |
266 ResourceRequest resourceRequest = frame->loader().resourceRequestForReload( | 269 ResourceRequest resourceRequest = frame->loader().resourceRequestForReload( |
267 FrameLoadTypeReload, KURL(), ClientRedirectPolicy::ClientRedirect); | 270 FrameLoadTypeReload, KURL(), ClientRedirectPolicy::ClientRedirect); |
268 if (resourceRequest.isNull()) | 271 if (resourceRequest.isNull()) |
269 return; | 272 return; |
270 FrameLoadRequest request = FrameLoadRequest(nullptr, resourceRequest); | 273 FrameLoadRequest request = FrameLoadRequest(nullptr, resourceRequest); |
271 request.setClientRedirect(ClientRedirectPolicy::ClientRedirect); | 274 request.setClientRedirect(ClientRedirectPolicy::ClientRedirect); |
272 maybeLogScheduledNavigationClobber(ScheduledNavigationType::ScheduledReload, | 275 maybeLogScheduledNavigationClobber(ScheduledNavigationType::ScheduledReload, |
273 frame); | 276 frame); |
274 frame->loader().load(request, FrameLoadTypeReload); | 277 frame->loader().load(request, m_type); |
kouhei (in TOK)
2016/12/14 10:57:41
Instead of referring to m_type here, can this also
Takashi Toyoshima
2016/12/14 12:31:10
Done.
| |
275 } | 278 } |
276 | 279 |
277 private: | 280 private: |
278 ScheduledReload() : ScheduledNavigation(0.0, nullptr, true, true) {} | 281 ScheduledReload(FrameLoadType type) |
282 : ScheduledNavigation(0.0, nullptr, true, true), m_type(type) {} | |
283 | |
284 FrameLoadType m_type; | |
279 }; | 285 }; |
280 | 286 |
281 class ScheduledPageBlock final : public ScheduledNavigation { | 287 class ScheduledPageBlock final : public ScheduledNavigation { |
282 public: | 288 public: |
283 static ScheduledPageBlock* create(Document* originDocument, int reason) { | 289 static ScheduledPageBlock* create(Document* originDocument, int reason) { |
284 return new ScheduledPageBlock(originDocument, reason); | 290 return new ScheduledPageBlock(originDocument, reason); |
285 } | 291 } |
286 | 292 |
287 void fire(LocalFrame* frame) override { | 293 void fire(LocalFrame* frame) override { |
288 frame->loader().client()->loadErrorPage(m_reason); | 294 frame->loader().client()->loadErrorPage(m_reason); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
457 schedule(ScheduledPageBlock::create(originDocument, reason)); | 463 schedule(ScheduledPageBlock::create(originDocument, reason)); |
458 } | 464 } |
459 | 465 |
460 void NavigationScheduler::scheduleFormSubmission(Document* document, | 466 void NavigationScheduler::scheduleFormSubmission(Document* document, |
461 FormSubmission* submission) { | 467 FormSubmission* submission) { |
462 DCHECK(m_frame->page()); | 468 DCHECK(m_frame->page()); |
463 schedule(ScheduledFormSubmission::create(document, submission, | 469 schedule(ScheduledFormSubmission::create(document, submission, |
464 mustReplaceCurrentItem(m_frame))); | 470 mustReplaceCurrentItem(m_frame))); |
465 } | 471 } |
466 | 472 |
467 void NavigationScheduler::scheduleReload() { | 473 void NavigationScheduler::scheduleReload(FrameLoadType type) { |
468 if (!shouldScheduleReload()) | 474 if (!shouldScheduleReload()) |
469 return; | 475 return; |
470 if (m_frame->document()->url().isEmpty()) | 476 if (m_frame->document()->url().isEmpty()) |
471 return; | 477 return; |
472 schedule(ScheduledReload::create()); | 478 schedule(ScheduledReload::create(type)); |
473 } | 479 } |
474 | 480 |
475 void NavigationScheduler::navigateTask() { | 481 void NavigationScheduler::navigateTask() { |
476 Platform::current()->currentThread()->scheduler()->removePendingNavigation( | 482 Platform::current()->currentThread()->scheduler()->removePendingNavigation( |
477 m_frameType); | 483 m_frameType); |
478 | 484 |
479 if (!m_frame->page()) | 485 if (!m_frame->page()) |
480 return; | 486 return; |
481 if (m_frame->page()->suspended()) { | 487 if (m_frame->page()->suspended()) { |
482 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); | 488 InspectorInstrumentation::frameClearedScheduledNavigation(m_frame); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
543 m_navigateTaskHandle.cancel(); | 549 m_navigateTaskHandle.cancel(); |
544 m_redirect.clear(); | 550 m_redirect.clear(); |
545 } | 551 } |
546 | 552 |
547 DEFINE_TRACE(NavigationScheduler) { | 553 DEFINE_TRACE(NavigationScheduler) { |
548 visitor->trace(m_frame); | 554 visitor->trace(m_frame); |
549 visitor->trace(m_redirect); | 555 visitor->trace(m_redirect); |
550 } | 556 } |
551 | 557 |
552 } // namespace blink | 558 } // namespace blink |
OLD | NEW |