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

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

Issue 2258873004: Leak Detector: Count ScriptPromise and ActiveDOMObject on worker threads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Bug fix: Build fail on ChromeOS Created 4 years, 4 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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 20 matching lines...) Expand all
31 31
32 namespace blink { 32 namespace blink {
33 33
34 ActiveDOMObject::ActiveDOMObject(ExecutionContext* executionContext) 34 ActiveDOMObject::ActiveDOMObject(ExecutionContext* executionContext)
35 : ContextLifecycleObserver(executionContext, ActiveDOMObjectType) 35 : ContextLifecycleObserver(executionContext, ActiveDOMObjectType)
36 #if DCHECK_IS_ON() 36 #if DCHECK_IS_ON()
37 , m_suspendIfNeededCalled(false) 37 , m_suspendIfNeededCalled(false)
38 #endif 38 #endif
39 { 39 {
40 DCHECK(!executionContext || executionContext->isContextThread()); 40 DCHECK(!executionContext || executionContext->isContextThread());
41 // TODO(hajimehoshi): Now the leak detector can't treat vaious threads other 41 InstanceCounters::incrementCounter(InstanceCounters::ActiveDOMObjectCounter) ;
42 // than the main thread and worker threads. After fixing the leak detector,
43 // let's count objects on other threads as many as possible.
44 if (isMainThread())
45 InstanceCounters::incrementCounter(InstanceCounters::ActiveDOMObjectCoun ter);
46 } 42 }
47 43
48 ActiveDOMObject::~ActiveDOMObject() 44 ActiveDOMObject::~ActiveDOMObject()
49 { 45 {
50 if (isMainThread()) 46 InstanceCounters::decrementCounter(InstanceCounters::ActiveDOMObjectCounter) ;
51 InstanceCounters::decrementCounter(InstanceCounters::ActiveDOMObjectCoun ter);
52 47
53 #if DCHECK_IS_ON() 48 #if DCHECK_IS_ON()
54 DCHECK(m_suspendIfNeededCalled); 49 DCHECK(m_suspendIfNeededCalled);
55 #endif 50 #endif
56 } 51 }
57 52
58 void ActiveDOMObject::suspendIfNeeded() 53 void ActiveDOMObject::suspendIfNeeded()
59 { 54 {
60 #if DCHECK_IS_ON() 55 #if DCHECK_IS_ON()
61 DCHECK(!m_suspendIfNeededCalled); 56 DCHECK(!m_suspendIfNeededCalled);
(...skipping 26 matching lines...) Expand all
88 83
89 if (context->activeDOMObjectsAreSuspended()) { 84 if (context->activeDOMObjectsAreSuspended()) {
90 suspend(); 85 suspend();
91 return; 86 return;
92 } 87 }
93 88
94 resume(); 89 resume();
95 } 90 }
96 91
97 } // namespace blink 92 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698