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

Side by Side Diff: third_party/WebKit/Source/core/page/Page.h

Issue 2616513002: Make sure pages that are closing but not yet closed are still suspended. (Closed)
Patch Set: Created 3 years, 11 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) 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. 4 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved.
5 * (http://www.torchmobile.com/) 5 * (http://www.torchmobile.com/)
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 class ContextMenuController; 53 class ContextMenuController;
54 class Document; 54 class Document;
55 class DragCaretController; 55 class DragCaretController;
56 class DragController; 56 class DragController;
57 class EditorClient; 57 class EditorClient;
58 class FocusController; 58 class FocusController;
59 class Frame; 59 class Frame;
60 class FrameHost; 60 class FrameHost;
61 class PluginData; 61 class PluginData;
62 class PointerLockController; 62 class PointerLockController;
63 class ScopedPageSuspender;
63 class ScrollingCoordinator; 64 class ScrollingCoordinator;
64 class Settings; 65 class Settings;
65 class SpellCheckerClient; 66 class SpellCheckerClient;
66 class ValidationMessageClient; 67 class ValidationMessageClient;
67 class WebLayerTreeView; 68 class WebLayerTreeView;
68 69
69 typedef uint64_t LinkHash; 70 typedef uint64_t LinkHash;
70 71
71 float deviceScaleFactor(LocalFrame*); 72 float deviceScaleFactor(LocalFrame*);
72 73
(...skipping 24 matching lines...) Expand all
97 98
98 static Page* create(PageClients& pageClients) { 99 static Page* create(PageClients& pageClients) {
99 return new Page(pageClients); 100 return new Page(pageClients);
100 } 101 }
101 102
102 // An "ordinary" page is a fully-featured page owned by a web view. 103 // An "ordinary" page is a fully-featured page owned by a web view.
103 static Page* createOrdinary(PageClients&); 104 static Page* createOrdinary(PageClients&);
104 105
105 ~Page() override; 106 ~Page() override;
106 107
107 void willBeClosed(); 108 void closeSoon();
109 bool isClosing() const { return m_isClosing; }
108 110
109 using PageSet = PersistentHeapHashSet<WeakMember<Page>>; 111 using PageSet = PersistentHeapHashSet<WeakMember<Page>>;
110 112
111 // Return the current set of full-fledged, ordinary pages. 113 // Return the current set of full-fledged, ordinary pages.
112 // Each created and owned by a WebView. 114 // Each created and owned by a WebView.
113 // 115 //
114 // This set does not include Pages created for other, internal purposes 116 // This set does not include Pages created for other, internal purposes
115 // (SVGImages, inspector overlays, page popups etc.) 117 // (SVGImages, inspector overlays, page popups etc.)
116 static PageSet& ordinaryPages(); 118 static PageSet& ordinaryPages();
117 119
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 Deprecation& deprecation() { return m_deprecation; } 182 Deprecation& deprecation() { return m_deprecation; }
181 HostsUsingFeatures& hostsUsingFeatures() { return m_hostsUsingFeatures; } 183 HostsUsingFeatures& hostsUsingFeatures() { return m_hostsUsingFeatures; }
182 184
183 void setTabKeyCyclesThroughElements(bool b) { 185 void setTabKeyCyclesThroughElements(bool b) {
184 m_tabKeyCyclesThroughElements = b; 186 m_tabKeyCyclesThroughElements = b;
185 } 187 }
186 bool tabKeyCyclesThroughElements() const { 188 bool tabKeyCyclesThroughElements() const {
187 return m_tabKeyCyclesThroughElements; 189 return m_tabKeyCyclesThroughElements;
188 } 190 }
189 191
190 // DefersLoading is used to delay loads during modal dialogs. 192 // Suspension is used to implement the "Optionally, pause while waiting for
191 // Modal dialogs are supposed to freeze all background processes 193 // the user to acknowledge the message" step of simple dialog processing:
192 // in the page, including prevent additional loads from staring/continuing. 194 // https://html.spec.whatwg.org/multipage/webappapis.html#simple-dialogs
193 void setSuspended(bool); 195 //
196 // Per https://html.spec.whatwg.org/multipage/webappapis.html#pause, no loads
197 // are allowed to start/continue in this state, and all background processing
198 // is also suspended.
194 bool suspended() const { return m_suspended; } 199 bool suspended() const { return m_suspended; }
195 200
196 void setPageScaleFactor(float); 201 void setPageScaleFactor(float);
197 float pageScaleFactor() const; 202 float pageScaleFactor() const;
198 203
199 float deviceScaleFactor() const { return m_deviceScaleFactor; } 204 float deviceScaleFactor() const { return m_deviceScaleFactor; }
200 void setDeviceScaleFactor(float); 205 void setDeviceScaleFactor(float);
201 206
202 static void allVisitedStateChanged(bool invalidateVisitedLinkHashes); 207 static void allVisitedStateChanged(bool invalidateVisitedLinkHashes);
203 static void visitedStateChanged(LinkHash visitedHash); 208 static void visitedStateChanged(LinkHash visitedHash);
(...skipping 17 matching lines...) Expand all
221 static void networkStateChanged(bool online); 226 static void networkStateChanged(bool online);
222 227
223 DECLARE_TRACE(); 228 DECLARE_TRACE();
224 229
225 void layerTreeViewInitialized(WebLayerTreeView&); 230 void layerTreeViewInitialized(WebLayerTreeView&);
226 void willCloseLayerTreeView(WebLayerTreeView&); 231 void willCloseLayerTreeView(WebLayerTreeView&);
227 232
228 void willBeDestroyed(); 233 void willBeDestroyed();
229 234
230 private: 235 private:
236 friend class ScopedPageSuspender;
237
231 explicit Page(PageClients&); 238 explicit Page(PageClients&);
232 239
233 void initGroup(); 240 void initGroup();
234 241
235 // SettingsDelegate overrides. 242 // SettingsDelegate overrides.
236 void settingsChanged(SettingsDelegate::ChangeType) override; 243 void settingsChanged(SettingsDelegate::ChangeType) override;
237 244
245 // ScopedPageSuspender helpers.
246 void setSuspended(bool);
247
238 Member<PageAnimator> m_animator; 248 Member<PageAnimator> m_animator;
239 const Member<AutoscrollController> m_autoscrollController; 249 const Member<AutoscrollController> m_autoscrollController;
240 Member<ChromeClient> m_chromeClient; 250 Member<ChromeClient> m_chromeClient;
241 const Member<DragCaretController> m_dragCaretController; 251 const Member<DragCaretController> m_dragCaretController;
242 const Member<DragController> m_dragController; 252 const Member<DragController> m_dragController;
243 const Member<FocusController> m_focusController; 253 const Member<FocusController> m_focusController;
244 const Member<ContextMenuController> m_contextMenuController; 254 const Member<ContextMenuController> m_contextMenuController;
245 const Member<PointerLockController> m_pointerLockController; 255 const Member<PointerLockController> m_pointerLockController;
246 Member<ScrollingCoordinator> m_scrollingCoordinator; 256 Member<ScrollingCoordinator> m_scrollingCoordinator;
247 257
(...skipping 15 matching lines...) Expand all
263 273
264 EditorClient* const m_editorClient; 274 EditorClient* const m_editorClient;
265 SpellCheckerClient* const m_spellCheckerClient; 275 SpellCheckerClient* const m_spellCheckerClient;
266 Member<ValidationMessageClient> m_validationMessageClient; 276 Member<ValidationMessageClient> m_validationMessageClient;
267 277
268 UseCounter m_useCounter; 278 UseCounter m_useCounter;
269 Deprecation m_deprecation; 279 Deprecation m_deprecation;
270 HostsUsingFeatures m_hostsUsingFeatures; 280 HostsUsingFeatures m_hostsUsingFeatures;
271 281
272 bool m_openedByDOM; 282 bool m_openedByDOM;
283 // Set to true when window.close() has been called and the Page will be
284 // destroyed. The browsing contexts in this page should no longer be
285 // discoverable via JS.
286 // TODO(dcheng): Try to remove |DOMWindow::m_windowIsClosing| in favor of
287 // this. However, this depends on resolving https://crbug.com/674641
288 bool m_isClosing;
273 289
274 bool m_tabKeyCyclesThroughElements; 290 bool m_tabKeyCyclesThroughElements;
275 bool m_suspended; 291 bool m_suspended;
276 292
277 float m_deviceScaleFactor; 293 float m_deviceScaleFactor;
278 294
279 PageVisibilityState m_visibilityState; 295 PageVisibilityState m_visibilityState;
280 296
281 bool m_isCursorVisible; 297 bool m_isCursorVisible;
282 298
283 #if ENABLE(ASSERT) 299 #if ENABLE(ASSERT)
284 bool m_isPainting; 300 bool m_isPainting;
285 #endif 301 #endif
286 302
287 // A pointer to all the interfaces provided to in-process Frames for this 303 // A pointer to all the interfaces provided to in-process Frames for this
288 // Page. 304 // Page.
289 // FIXME: Most of the members of Page should move onto FrameHost. 305 // FIXME: Most of the members of Page should move onto FrameHost.
290 Member<FrameHost> m_frameHost; 306 Member<FrameHost> m_frameHost;
291 }; 307 };
292 308
293 extern template class CORE_EXTERN_TEMPLATE_EXPORT Supplement<Page>; 309 extern template class CORE_EXTERN_TEMPLATE_EXPORT Supplement<Page>;
294 310
295 } // namespace blink 311 } // namespace blink
296 312
297 #endif // Page_h 313 #endif // Page_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/page/FrameTree.cpp ('k') | third_party/WebKit/Source/core/page/Page.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698