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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2052583003: Limit live Document tracking to debug builds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « no previous file | no next file » | 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, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 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) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 #include "wtf/HashFunctions.h" 235 #include "wtf/HashFunctions.h"
236 #include "wtf/PtrUtil.h" 236 #include "wtf/PtrUtil.h"
237 #include "wtf/StdLibExtras.h" 237 #include "wtf/StdLibExtras.h"
238 #include "wtf/TemporaryChange.h" 238 #include "wtf/TemporaryChange.h"
239 #include "wtf/text/StringBuffer.h" 239 #include "wtf/text/StringBuffer.h"
240 #include "wtf/text/TextEncodingRegistry.h" 240 #include "wtf/text/TextEncodingRegistry.h"
241 241
242 using namespace WTF; 242 using namespace WTF;
243 using namespace Unicode; 243 using namespace Unicode;
244 244
245 #ifndef NDEBUG
246 using WeakDocumentSet = blink::PersistentHeapHashSet<blink::WeakMember<blink::Do cument>>;
247 static WeakDocumentSet& liveDocumentSet();
248 #endif
249
245 namespace blink { 250 namespace blink {
246 251
247 using namespace HTMLNames; 252 using namespace HTMLNames;
248 253
249 static const unsigned cMaxWriteRecursionDepth = 21; 254 static const unsigned cMaxWriteRecursionDepth = 21;
250 255
251 // This amount of time must have elapsed before we will even consider scheduling a layout without a delay. 256 // This amount of time must have elapsed before we will even consider scheduling a layout without a delay.
252 // FIXME: For faster machines this value can really be lowered to 200. 250 is a dequate, but a little high 257 // FIXME: For faster machines this value can really be lowered to 200. 250 is a dequate, but a little high
253 // for dual G5s. :) 258 // for dual G5s. :)
254 static const int cLayoutScheduleThreshold = 250; 259 static const int cLayoutScheduleThreshold = 250;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 return true; 365 return true;
361 if (errorMessage) 366 if (errorMessage)
362 *errorMessage = origin->isPotentiallyTrustworthyErrorMessage(); 367 *errorMessage = origin->isPotentiallyTrustworthyErrorMessage();
363 return false; 368 return false;
364 } 369 }
365 370
366 uint64_t Document::s_globalTreeVersion = 0; 371 uint64_t Document::s_globalTreeVersion = 0;
367 372
368 static bool s_threadedParsingEnabledForTesting = true; 373 static bool s_threadedParsingEnabledForTesting = true;
369 374
370 using WeakDocumentSet = PersistentHeapHashSet<WeakMember<Document>>;
371
372 static WeakDocumentSet& liveDocumentSet()
373 {
374 DEFINE_STATIC_LOCAL(WeakDocumentSet, set, ());
375 return set;
376 }
377
378 // This class doesn't work with non-Document ExecutionContext. 375 // This class doesn't work with non-Document ExecutionContext.
379 class AutofocusTask final : public ExecutionContextTask { 376 class AutofocusTask final : public ExecutionContextTask {
380 public: 377 public:
381 static std::unique_ptr<AutofocusTask> create() 378 static std::unique_ptr<AutofocusTask> create()
382 { 379 {
383 return wrapUnique(new AutofocusTask()); 380 return wrapUnique(new AutofocusTask());
384 } 381 }
385 ~AutofocusTask() override { } 382 ~AutofocusTask() override { }
386 383
387 private: 384 private:
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 // CSSFontSelector, need to initialize m_styleEngine after initializing 504 // CSSFontSelector, need to initialize m_styleEngine after initializing
508 // m_fetcher. 505 // m_fetcher.
509 m_styleEngine = StyleEngine::create(*this); 506 m_styleEngine = StyleEngine::create(*this);
510 507
511 // The parent's parser should be suspended together with all the other objec ts, 508 // The parent's parser should be suspended together with all the other objec ts,
512 // else this new Document would have a new ExecutionContext which suspended state 509 // else this new Document would have a new ExecutionContext which suspended state
513 // would not match the one from the parent, and could start loading resource s 510 // would not match the one from the parent, and could start loading resource s
514 // ignoring the defersLoading flag. 511 // ignoring the defersLoading flag.
515 DCHECK(!parentDocument() || !parentDocument()->activeDOMObjectsAreSuspended( )); 512 DCHECK(!parentDocument() || !parentDocument()->activeDOMObjectsAreSuspended( ));
516 513
514 #ifndef NDEBUG
517 liveDocumentSet().add(this); 515 liveDocumentSet().add(this);
516 #endif
518 } 517 }
519 518
520 Document::~Document() 519 Document::~Document()
521 { 520 {
522 DCHECK(!layoutView()); 521 DCHECK(!layoutView());
523 DCHECK(!parentTreeScope()); 522 DCHECK(!parentTreeScope());
524 // If a top document with a cache, verify that it was comprehensively 523 // If a top document with a cache, verify that it was comprehensively
525 // cleared during detach. 524 // cleared during detach.
526 DCHECK(!m_axObjectCache); 525 DCHECK(!m_axObjectCache);
527 InstanceCounters::decrementCounter(InstanceCounters::DocumentCounter); 526 InstanceCounters::decrementCounter(InstanceCounters::DocumentCounter);
(...skipping 5461 matching lines...) Expand 10 before | Expand all | Expand 10 after
5989 } 5988 }
5990 ContainerNode::traceWrappers(visitor); 5989 ContainerNode::traceWrappers(visitor);
5991 } 5990 }
5992 5991
5993 template class CORE_TEMPLATE_EXPORT Supplement<Document>; 5992 template class CORE_TEMPLATE_EXPORT Supplement<Document>;
5994 5993
5995 } // namespace blink 5994 } // namespace blink
5996 5995
5997 #ifndef NDEBUG 5996 #ifndef NDEBUG
5998 using namespace blink; 5997 using namespace blink;
5998
5999 static WeakDocumentSet& liveDocumentSet()
6000 {
6001 DEFINE_STATIC_LOCAL(WeakDocumentSet, set, ());
6002 return set;
6003 }
6004
5999 void showLiveDocumentInstances() 6005 void showLiveDocumentInstances()
6000 { 6006 {
6001 WeakDocumentSet& set = liveDocumentSet(); 6007 WeakDocumentSet& set = liveDocumentSet();
6002 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6008 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6003 for (Document* document : set) 6009 for (Document* document : set)
6004 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data()); 6010 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get String().utf8().data());
6005 } 6011 }
6006 #endif 6012 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698