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

Side by Side Diff: third_party/WebKit/Source/web/WebKit.cpp

Issue 1773273004: Move code to register/unregister memory dump provider from blink::initialize/shutdown (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 OwnPtr<V8IsolateInterruptor> interruptor = adoptPtr(new V8IsolateInterruptor (V8PerIsolateData::mainThreadIsolate())); 110 OwnPtr<V8IsolateInterruptor> interruptor = adoptPtr(new V8IsolateInterruptor (V8PerIsolateData::mainThreadIsolate()));
111 ThreadState::current()->addInterruptor(interruptor.release()); 111 ThreadState::current()->addInterruptor(interruptor.release());
112 ThreadState::current()->registerTraceDOMWrappers(V8PerIsolateData::mainThrea dIsolate(), V8GCController::traceDOMWrappers); 112 ThreadState::current()->registerTraceDOMWrappers(V8PerIsolateData::mainThrea dIsolate(), V8GCController::traceDOMWrappers);
113 113
114 // currentThread is null if we are running on a thread without a message loo p. 114 // currentThread is null if we are running on a thread without a message loo p.
115 if (WebThread* currentThread = platform->currentThread()) { 115 if (WebThread* currentThread = platform->currentThread()) {
116 ASSERT(!s_endOfTaskRunner); 116 ASSERT(!s_endOfTaskRunner);
117 s_endOfTaskRunner = new EndOfTaskRunner; 117 s_endOfTaskRunner = new EndOfTaskRunner;
118 currentThread->addTaskObserver(s_endOfTaskRunner); 118 currentThread->addTaskObserver(s_endOfTaskRunner);
119
120 // Register web cache dump provider for tracing.
121 platform->registerMemoryDumpProvider(WebCacheMemoryDumpProvider::instanc e(), "MemoryCache");
122 platform->registerMemoryDumpProvider(FontCacheMemoryDumpProvider::instan ce(), "FontCaches");
123 } 119 }
124 } 120 }
125 121
126 v8::Isolate* mainThreadIsolate() 122 v8::Isolate* mainThreadIsolate()
127 { 123 {
128 return V8PerIsolateData::mainThreadIsolate(); 124 return V8PerIsolateData::mainThreadIsolate();
129 } 125 }
130 126
131 static void maxObservedSizeFunction(size_t sizeInMB) 127 static void maxObservedSizeFunction(size_t sizeInMB)
132 { 128 {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // not scanned by LSan due to being held in non-global storage 179 // not scanned by LSan due to being held in non-global storage
184 // ("static" references inside functions/methods.) 180 // ("static" references inside functions/methods.)
185 if (ThreadState* threadState = ThreadState::current()) { 181 if (ThreadState* threadState = ThreadState::current()) {
186 threadState->releaseStaticPersistentNodes(); 182 threadState->releaseStaticPersistentNodes();
187 Heap::collectAllGarbage(); 183 Heap::collectAllGarbage();
188 } 184 }
189 #endif 185 #endif
190 186
191 // currentThread() is null if we are running on a thread without a message l oop. 187 // currentThread() is null if we are running on a thread without a message l oop.
192 if (Platform::current()->currentThread()) { 188 if (Platform::current()->currentThread()) {
193 Platform::current()->unregisterMemoryDumpProvider(WebCacheMemoryDumpProv ider::instance());
194 Platform::current()->unregisterMemoryDumpProvider(FontCacheMemoryDumpPro vider::instance());
195
196 // We don't need to (cannot) remove s_endOfTaskRunner from the current 189 // We don't need to (cannot) remove s_endOfTaskRunner from the current
197 // message loop, because the message loop is already destructed before 190 // message loop, because the message loop is already destructed before
198 // the shutdown() is called. 191 // the shutdown() is called.
199 delete s_endOfTaskRunner; 192 delete s_endOfTaskRunner;
200 s_endOfTaskRunner = nullptr; 193 s_endOfTaskRunner = nullptr;
201 } 194 }
202 195
203 // Shutdown V8-related background threads before V8 is ramped down. Note 196 // Shutdown V8-related background threads before V8 is ramped down. Note
204 // that this will wait the thread to stop its operations. 197 // that this will wait the thread to stop its operations.
205 ScriptStreamerThread::shutdown(); 198 ScriptStreamerThread::shutdown();
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 ASSERT(!reloadPages); 280 ASSERT(!reloadPages);
288 Page::refreshPlugins(); 281 Page::refreshPlugins();
289 } 282 }
290 283
291 void decommitFreeableMemory() 284 void decommitFreeableMemory()
292 { 285 {
293 WTF::Partitions::decommitFreeableMemory(); 286 WTF::Partitions::decommitFreeableMemory();
294 } 287 }
295 288
296 } // namespace blink 289 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698