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

Side by Side Diff: Source/core/dom/Document.h

Issue 117703004: Free temporary GPU and memory resources held by inactive or hidden 2D canvases (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: typo Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/dom/Document.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
9 * Copyright (C) 2011 Google Inc. All rights reserved. 9 * Copyright (C) 2011 Google Inc. All rights reserved.
10 * 10 *
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 XHTMLDocumentClass = 1 << 1, 204 XHTMLDocumentClass = 1 << 1,
205 ImageDocumentClass = 1 << 2, 205 ImageDocumentClass = 1 << 2,
206 PluginDocumentClass = 1 << 3, 206 PluginDocumentClass = 1 << 3,
207 MediaDocumentClass = 1 << 4, 207 MediaDocumentClass = 1 << 4,
208 SVGDocumentClass = 1 << 5, 208 SVGDocumentClass = 1 << 5,
209 XMLDocumentClass = 1 << 6, 209 XMLDocumentClass = 1 << 6,
210 }; 210 };
211 211
212 typedef unsigned char DocumentClassFlags; 212 typedef unsigned char DocumentClassFlags;
213 213
214 class Document;
215
216 class DocumentVisibilityObserver {
217 public:
218 DocumentVisibilityObserver(Document&);
219 virtual ~DocumentVisibilityObserver();
220
221 virtual void didChangeVisibilityState(PageVisibilityState) = 0;
222
223 // Classes that inherit Node and DocumentVisibilityObserver must have a
224 // virtual override of Node::didMoveToNewDocument that calls
225 // DocumentVisibilityObserver::setDocument
226 void setObservedDocument(Document&);
227
228 private:
229 void registerObserver(Document&);
230 void unregisterObserver();
231 Document* m_document;
232 };
233
214 class Document : public ContainerNode, public TreeScope, public SecurityContext, public ExecutionContext, public ExecutionContextClient 234 class Document : public ContainerNode, public TreeScope, public SecurityContext, public ExecutionContext, public ExecutionContextClient
215 , public DocumentSupplementable, public LifecycleContext<Document> { 235 , public DocumentSupplementable, public LifecycleContext<Document> {
216 public: 236 public:
217 static PassRefPtr<Document> create(const DocumentInit& initializer = Documen tInit()) 237 static PassRefPtr<Document> create(const DocumentInit& initializer = Documen tInit())
218 { 238 {
219 return adoptRef(new Document(initializer)); 239 return adoptRef(new Document(initializer));
220 } 240 }
221 virtual ~Document(); 241 virtual ~Document();
222 242
223 MediaQueryMatcher& mediaQueryMatcher(); 243 MediaQueryMatcher& mediaQueryMatcher();
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 374
355 void setXMLEncoding(const String& encoding) { m_xmlEncoding = encoding; } // read-only property, only to be set from XMLDocumentParser 375 void setXMLEncoding(const String& encoding) { m_xmlEncoding = encoding; } // read-only property, only to be set from XMLDocumentParser
356 void setXMLVersion(const String&, ExceptionState&); 376 void setXMLVersion(const String&, ExceptionState&);
357 void setXMLStandalone(bool, ExceptionState&); 377 void setXMLStandalone(bool, ExceptionState&);
358 void setHasXMLDeclaration(bool hasXMLDeclaration) { m_hasXMLDeclaration = ha sXMLDeclaration ? 1 : 0; } 378 void setHasXMLDeclaration(bool hasXMLDeclaration) { m_hasXMLDeclaration = ha sXMLDeclaration ? 1 : 0; }
359 379
360 virtual KURL baseURI() const OVERRIDE FINAL; 380 virtual KURL baseURI() const OVERRIDE FINAL;
361 381
362 String visibilityState() const; 382 String visibilityState() const;
363 bool hidden() const; 383 bool hidden() const;
364 void dispatchVisibilityStateChangeEvent(); 384 void didChangeVisibilityState();
365 385
366 PassRefPtr<Node> adoptNode(PassRefPtr<Node> source, ExceptionState&); 386 PassRefPtr<Node> adoptNode(PassRefPtr<Node> source, ExceptionState&);
367 387
368 PassRefPtr<HTMLCollection> images(); 388 PassRefPtr<HTMLCollection> images();
369 PassRefPtr<HTMLCollection> embeds(); 389 PassRefPtr<HTMLCollection> embeds();
370 PassRefPtr<HTMLCollection> applets(); 390 PassRefPtr<HTMLCollection> applets();
371 PassRefPtr<HTMLCollection> links(); 391 PassRefPtr<HTMLCollection> links();
372 PassRefPtr<HTMLCollection> forms(); 392 PassRefPtr<HTMLCollection> forms();
373 PassRefPtr<HTMLCollection> anchors(); 393 PassRefPtr<HTMLCollection> anchors();
374 PassRefPtr<HTMLCollection> scripts(); 394 PassRefPtr<HTMLCollection> scripts();
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 }; 1028 };
1009 void maybeHandleHttpRefresh(const String&, HttpRefreshType); 1029 void maybeHandleHttpRefresh(const String&, HttpRefreshType);
1010 1030
1011 void updateSecurityOrigin(PassRefPtr<SecurityOrigin>); 1031 void updateSecurityOrigin(PassRefPtr<SecurityOrigin>);
1012 PassOwnPtr<LifecycleNotifier<Document> > createLifecycleNotifier(); 1032 PassOwnPtr<LifecycleNotifier<Document> > createLifecycleNotifier();
1013 1033
1014 void setHasViewportUnits() { m_hasViewportUnits = true; } 1034 void setHasViewportUnits() { m_hasViewportUnits = true; }
1015 bool hasViewportUnits() const { return m_hasViewportUnits; } 1035 bool hasViewportUnits() const { return m_hasViewportUnits; }
1016 void notifyResizeForViewportUnits(); 1036 void notifyResizeForViewportUnits();
1017 1037
1038 void registerVisibilityObserver(DocumentVisibilityObserver*);
1039 void unregisterVisibilityObserver(DocumentVisibilityObserver*);
1040
1018 protected: 1041 protected:
1019 Document(const DocumentInit&, DocumentClassFlags = DefaultDocumentClass); 1042 Document(const DocumentInit&, DocumentClassFlags = DefaultDocumentClass);
1020 1043
1021 virtual void didUpdateSecurityOrigin() OVERRIDE FINAL; 1044 virtual void didUpdateSecurityOrigin() OVERRIDE FINAL;
1022 1045
1023 void clearXMLVersion() { m_xmlVersion = String(); } 1046 void clearXMLVersion() { m_xmlVersion = String(); }
1024 1047
1025 virtual void dispose() OVERRIDE; 1048 virtual void dispose() OVERRIDE;
1026 1049
1027 virtual PassRefPtr<Document> cloneDocumentWithoutChildren(); 1050 virtual PassRefPtr<Document> cloneDocumentWithoutChildren();
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 1323
1301 RefPtr<Document> m_templateDocument; 1324 RefPtr<Document> m_templateDocument;
1302 Document* m_templateDocumentHost; // Manually managed weakref (backpointer f rom m_templateDocument). 1325 Document* m_templateDocumentHost; // Manually managed weakref (backpointer f rom m_templateDocument).
1303 1326
1304 Timer<Document> m_didAssociateFormControlsTimer; 1327 Timer<Document> m_didAssociateFormControlsTimer;
1305 HashSet<RefPtr<Element> > m_associatedFormControls; 1328 HashSet<RefPtr<Element> > m_associatedFormControls;
1306 1329
1307 HashSet<SVGUseElement*> m_useElementsNeedingUpdate; 1330 HashSet<SVGUseElement*> m_useElementsNeedingUpdate;
1308 1331
1309 bool m_hasViewportUnits; 1332 bool m_hasViewportUnits;
1333
1334 HashSet<DocumentVisibilityObserver*> m_visibilityObservers;
1310 }; 1335 };
1311 1336
1312 inline void Document::notifyRemovePendingSheetIfNeeded() 1337 inline void Document::notifyRemovePendingSheetIfNeeded()
1313 { 1338 {
1314 if (m_needsNotifyRemoveAllPendingStylesheet) 1339 if (m_needsNotifyRemoveAllPendingStylesheet)
1315 didRemoveAllPendingStylesheet(); 1340 didRemoveAllPendingStylesheet();
1316 } 1341 }
1317 1342
1318 inline const Document* Document::templateDocument() const 1343 inline const Document* Document::templateDocument() const
1319 { 1344 {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 inline bool Node::isDocumentNode() const 1376 inline bool Node::isDocumentNode() const
1352 { 1377 {
1353 return this == document(); 1378 return this == document();
1354 } 1379 }
1355 1380
1356 Node* eventTargetNodeForDocument(Document*); 1381 Node* eventTargetNodeForDocument(Document*);
1357 1382
1358 } // namespace WebCore 1383 } // namespace WebCore
1359 1384
1360 #endif // Document_h 1385 #endif // Document_h
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698