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

Side by Side Diff: Source/web/WebLeakDetector.cpp

Issue 450183002: Add instance counters of Resource and AudioNode, and expose them via WebLeakDetector. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/modules/webaudio/AudioNode.cpp ('k') | public/web/WebLeakDetector.h » ('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) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 21 matching lines...) Expand all
32 32
33 #include "public/web/WebLeakDetector.h" 33 #include "public/web/WebLeakDetector.h"
34 34
35 #include "bindings/core/v8/V8Binding.h" 35 #include "bindings/core/v8/V8Binding.h"
36 #include "bindings/core/v8/V8GCController.h" 36 #include "bindings/core/v8/V8GCController.h"
37 #include "core/dom/Document.h" 37 #include "core/dom/Document.h"
38 #include "core/fetch/MemoryCache.h" 38 #include "core/fetch/MemoryCache.h"
39 #include "core/fetch/ResourceFetcher.h" 39 #include "core/fetch/ResourceFetcher.h"
40 #include "core/inspector/InspectorCounters.h" 40 #include "core/inspector/InspectorCounters.h"
41 #include "core/rendering/RenderObject.h" 41 #include "core/rendering/RenderObject.h"
42 #include "modules/webaudio/AudioNode.h"
42 #include "platform/Timer.h" 43 #include "platform/Timer.h"
43 #include "public/web/WebDocument.h" 44 #include "public/web/WebDocument.h"
44 #include "public/web/WebLocalFrame.h" 45 #include "public/web/WebLocalFrame.h"
45 #include "web/WebEmbeddedWorkerImpl.h" 46 #include "web/WebEmbeddedWorkerImpl.h"
46 47
47 #include <v8.h> 48 #include <v8.h>
48 49
49 using namespace blink; 50 using namespace blink;
50 51
51 namespace blink { 52 namespace blink {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 m_delayedGCAndReportTimer.startOneShot(0, FROM_HERE); 123 m_delayedGCAndReportTimer.startOneShot(0, FROM_HERE);
123 else 124 else
124 m_delayedReportTimer.startOneShot(0, FROM_HERE); 125 m_delayedReportTimer.startOneShot(0, FROM_HERE);
125 } 126 }
126 127
127 void WebLeakDetectorImpl::delayedReport(Timer<WebLeakDetectorImpl>*) 128 void WebLeakDetectorImpl::delayedReport(Timer<WebLeakDetectorImpl>*)
128 { 129 {
129 ASSERT(m_client); 130 ASSERT(m_client);
130 131
131 WebLeakDetectorClient::Result result; 132 WebLeakDetectorClient::Result result;
133 result.numberOfLiveAudioNodes = AudioNode::instanceCount();
132 result.numberOfLiveDocuments = InspectorCounters::counterValue(InspectorCoun ters::DocumentCounter); 134 result.numberOfLiveDocuments = InspectorCounters::counterValue(InspectorCoun ters::DocumentCounter);
133 result.numberOfLiveNodes = InspectorCounters::counterValue(InspectorCounters ::NodeCounter); 135 result.numberOfLiveNodes = InspectorCounters::counterValue(InspectorCounters ::NodeCounter);
134 result.numberOfLiveRenderObjects = RenderObject::instanceCount(); 136 result.numberOfLiveRenderObjects = RenderObject::instanceCount();
137 result.numberOfLiveResources = Resource::instanceCount();
135 138
136 m_client->onLeakDetectionComplete(result); 139 m_client->onLeakDetectionComplete(result);
137 140
138 #ifndef NDEBUG 141 #ifndef NDEBUG
139 showLiveDocumentInstances(); 142 showLiveDocumentInstances();
140 #endif 143 #endif
141 } 144 }
142 145
143 } // namespace 146 } // namespace
144 147
145 WebLeakDetector* WebLeakDetector::create(WebLeakDetectorClient* client) 148 WebLeakDetector* WebLeakDetector::create(WebLeakDetectorClient* client)
146 { 149 {
147 return new WebLeakDetectorImpl(client); 150 return new WebLeakDetectorImpl(client);
148 } 151 }
149 152
150 } // namespace blink 153 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/webaudio/AudioNode.cpp ('k') | public/web/WebLeakDetector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698