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

Side by Side Diff: third_party/WebKit/Source/core/loader/PrerenderHandle.cpp

Issue 2383403002: Reflow comments in core/loader (Closed)
Patch Set: yhirano comments Created 4 years, 2 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 27 matching lines...) Expand all
38 #include "platform/weborigin/ReferrerPolicy.h" 38 #include "platform/weborigin/ReferrerPolicy.h"
39 #include "platform/weborigin/SecurityPolicy.h" 39 #include "platform/weborigin/SecurityPolicy.h"
40 40
41 namespace blink { 41 namespace blink {
42 42
43 // static 43 // static
44 PrerenderHandle* PrerenderHandle::create(Document& document, 44 PrerenderHandle* PrerenderHandle::create(Document& document,
45 PrerenderClient* client, 45 PrerenderClient* client,
46 const KURL& url, 46 const KURL& url,
47 const unsigned prerenderRelTypes) { 47 const unsigned prerenderRelTypes) {
48 // Prerenders are unlike requests in most ways (for instance, they pass down f ragments, and they don't return data), 48 // Prerenders are unlike requests in most ways (for instance, they pass down
49 // but they do have referrers. 49 // fragments, and they don't return data), but they do have referrers.
50 if (!document.frame()) 50 if (!document.frame())
51 return nullptr; 51 return nullptr;
52 52
53 Prerender* prerender = Prerender::create( 53 Prerender* prerender = Prerender::create(
54 client, url, prerenderRelTypes, 54 client, url, prerenderRelTypes,
55 SecurityPolicy::generateReferrer(document.getReferrerPolicy(), url, 55 SecurityPolicy::generateReferrer(document.getReferrerPolicy(), url,
56 document.outgoingReferrer())); 56 document.outgoingReferrer()));
57 57
58 PrerendererClient* prerendererClient = 58 PrerendererClient* prerendererClient =
59 PrerendererClient::from(document.page()); 59 PrerendererClient::from(document.page());
(...skipping 10 matching lines...) Expand all
70 PrerenderHandle::~PrerenderHandle() { 70 PrerenderHandle::~PrerenderHandle() {
71 if (m_prerender) { 71 if (m_prerender) {
72 m_prerender->abandon(); 72 m_prerender->abandon();
73 detach(); 73 detach();
74 } 74 }
75 } 75 }
76 76
77 void PrerenderHandle::cancel() { 77 void PrerenderHandle::cancel() {
78 // Avoid both abandoning and canceling the same prerender. In the abandon 78 // Avoid both abandoning and canceling the same prerender. In the abandon
79 // case, the LinkLoader cancels the PrerenderHandle as the Document is 79 // case, the LinkLoader cancels the PrerenderHandle as the Document is
80 // destroyed, even through the ContextLifecycleObserver has already 80 // destroyed, even through the ContextLifecycleObserver has already abandoned
81 // abandoned it. 81 // it.
82 if (!m_prerender) 82 if (!m_prerender)
83 return; 83 return;
84 m_prerender->cancel(); 84 m_prerender->cancel();
85 detach(); 85 detach();
86 } 86 }
87 87
88 const KURL& PrerenderHandle::url() const { 88 const KURL& PrerenderHandle::url() const {
89 return m_prerender->url(); 89 return m_prerender->url();
90 } 90 }
91 91
92 void PrerenderHandle::contextDestroyed() { 92 void PrerenderHandle::contextDestroyed() {
93 // A PrerenderHandle is not removed from LifecycleNotifier::m_observers 93 // A PrerenderHandle is not removed from LifecycleNotifier::m_observers until
94 // until the next GC runs. Thus contextDestroyed() can be called for a 94 // the next GC runs. Thus contextDestroyed() can be called for a
95 // PrerenderHandle that is already cancelled (and thus detached). In that 95 // PrerenderHandle that is already cancelled (and thus detached). In that
96 // case, we should not detach the PrerenderHandle again. 96 // case, we should not detach the PrerenderHandle again.
97 if (!m_prerender) 97 if (!m_prerender)
98 return; 98 return;
99 m_prerender->abandon(); 99 m_prerender->abandon();
100 detach(); 100 detach();
101 } 101 }
102 102
103 void PrerenderHandle::detach() { 103 void PrerenderHandle::detach() {
104 m_prerender->dispose(); 104 m_prerender->dispose();
105 m_prerender.clear(); 105 m_prerender.clear();
106 } 106 }
107 107
108 DEFINE_TRACE(PrerenderHandle) { 108 DEFINE_TRACE(PrerenderHandle) {
109 visitor->trace(m_prerender); 109 visitor->trace(m_prerender);
110 ContextLifecycleObserver::trace(visitor); 110 ContextLifecycleObserver::trace(visitor);
111 } 111 }
112 112
113 } // namespace blink 113 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/PingLoader.cpp ('k') | third_party/WebKit/Source/core/loader/ProgressTracker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698