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

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
« no previous file with comments | « third_party/WebKit/Source/platform/exported/Platform.cpp ('k') | 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) 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 19 matching lines...) Expand all
30 30
31 #include "public/web/WebKit.h" 31 #include "public/web/WebKit.h"
32 32
33 #include "bindings/core/v8/ScriptStreamerThread.h" 33 #include "bindings/core/v8/ScriptStreamerThread.h"
34 #include "bindings/core/v8/V8Binding.h" 34 #include "bindings/core/v8/V8Binding.h"
35 #include "bindings/core/v8/V8GCController.h" 35 #include "bindings/core/v8/V8GCController.h"
36 #include "bindings/core/v8/V8Initializer.h" 36 #include "bindings/core/v8/V8Initializer.h"
37 #include "core/Init.h" 37 #include "core/Init.h"
38 #include "core/animation/AnimationClock.h" 38 #include "core/animation/AnimationClock.h"
39 #include "core/dom/Microtask.h" 39 #include "core/dom/Microtask.h"
40 #include "core/fetch/WebCacheMemoryDumpProvider.h"
41 #include "core/frame/Settings.h" 40 #include "core/frame/Settings.h"
42 #include "core/page/Page.h" 41 #include "core/page/Page.h"
43 #include "core/workers/WorkerGlobalScopeProxy.h" 42 #include "core/workers/WorkerGlobalScopeProxy.h"
44 #include "gin/public/v8_platform.h" 43 #include "gin/public/v8_platform.h"
45 #include "modules/InitModules.h" 44 #include "modules/InitModules.h"
46 #include "platform/Histogram.h" 45 #include "platform/Histogram.h"
47 #include "platform/LayoutTestSupport.h" 46 #include "platform/LayoutTestSupport.h"
48 #include "platform/Logging.h" 47 #include "platform/Logging.h"
49 #include "platform/RuntimeEnabledFeatures.h" 48 #include "platform/RuntimeEnabledFeatures.h"
50 #include "platform/ThreadSafeFunctional.h" 49 #include "platform/ThreadSafeFunctional.h"
51 #include "platform/fonts/FontCacheMemoryDumpProvider.h"
52 #include "platform/graphics/ImageDecodingStore.h" 50 #include "platform/graphics/ImageDecodingStore.h"
53 #include "platform/heap/GCTaskRunner.h" 51 #include "platform/heap/GCTaskRunner.h"
54 #include "platform/heap/Heap.h" 52 #include "platform/heap/Heap.h"
55 #include "public/platform/Platform.h" 53 #include "public/platform/Platform.h"
56 #include "public/platform/WebPrerenderingSupport.h" 54 #include "public/platform/WebPrerenderingSupport.h"
57 #include "public/platform/WebThread.h" 55 #include "public/platform/WebThread.h"
58 #include "web/IndexedDBClientImpl.h" 56 #include "web/IndexedDBClientImpl.h"
59 #include "wtf/Assertions.h" 57 #include "wtf/Assertions.h"
60 #include "wtf/CryptographicallyRandomNumber.h" 58 #include "wtf/CryptographicallyRandomNumber.h"
61 #include "wtf/MainThread.h" 59 #include "wtf/MainThread.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 modulesInitializer().init(); 103 modulesInitializer().init();
106 setIndexedDBClientCreateFunction(IndexedDBClientImpl::create); 104 setIndexedDBClientCreateFunction(IndexedDBClientImpl::create);
107 105
108 V8Initializer::initializeMainThread(); 106 V8Initializer::initializeMainThread();
109 107
110 // currentThread is null if we are running on a thread without a message loo p. 108 // currentThread is null if we are running on a thread without a message loo p.
111 if (WebThread* currentThread = platform->currentThread()) { 109 if (WebThread* currentThread = platform->currentThread()) {
112 ASSERT(!s_endOfTaskRunner); 110 ASSERT(!s_endOfTaskRunner);
113 s_endOfTaskRunner = new EndOfTaskRunner; 111 s_endOfTaskRunner = new EndOfTaskRunner;
114 currentThread->addTaskObserver(s_endOfTaskRunner); 112 currentThread->addTaskObserver(s_endOfTaskRunner);
115
116 // Register web cache dump provider for tracing.
117 platform->registerMemoryDumpProvider(WebCacheMemoryDumpProvider::instanc e(), "MemoryCache");
118 platform->registerMemoryDumpProvider(FontCacheMemoryDumpProvider::instan ce(), "FontCaches");
119 } 113 }
120 } 114 }
121 115
122 v8::Isolate* mainThreadIsolate() 116 v8::Isolate* mainThreadIsolate()
123 { 117 {
124 return V8PerIsolateData::mainThreadIsolate(); 118 return V8PerIsolateData::mainThreadIsolate();
125 } 119 }
126 120
127 static void maxObservedSizeFunction(size_t sizeInMB) 121 static void maxObservedSizeFunction(size_t sizeInMB)
128 { 122 {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 // not scanned by LSan due to being held in non-global storage 173 // not scanned by LSan due to being held in non-global storage
180 // ("static" references inside functions/methods.) 174 // ("static" references inside functions/methods.)
181 if (ThreadState* threadState = ThreadState::current()) { 175 if (ThreadState* threadState = ThreadState::current()) {
182 threadState->releaseStaticPersistentNodes(); 176 threadState->releaseStaticPersistentNodes();
183 Heap::collectAllGarbage(); 177 Heap::collectAllGarbage();
184 } 178 }
185 #endif 179 #endif
186 180
187 // currentThread() is null if we are running on a thread without a message l oop. 181 // currentThread() is null if we are running on a thread without a message l oop.
188 if (Platform::current()->currentThread()) { 182 if (Platform::current()->currentThread()) {
189 Platform::current()->unregisterMemoryDumpProvider(WebCacheMemoryDumpProv ider::instance());
190 Platform::current()->unregisterMemoryDumpProvider(FontCacheMemoryDumpPro vider::instance());
191
192 // We don't need to (cannot) remove s_endOfTaskRunner from the current 183 // We don't need to (cannot) remove s_endOfTaskRunner from the current
193 // message loop, because the message loop is already destructed before 184 // message loop, because the message loop is already destructed before
194 // the shutdown() is called. 185 // the shutdown() is called.
195 delete s_endOfTaskRunner; 186 delete s_endOfTaskRunner;
196 s_endOfTaskRunner = nullptr; 187 s_endOfTaskRunner = nullptr;
197 } 188 }
198 189
199 V8Initializer::shutdownMainThread(); 190 V8Initializer::shutdownMainThread();
200 191
201 modulesInitializer().shutdown(); 192 modulesInitializer().shutdown();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 ASSERT(!reloadPages); 269 ASSERT(!reloadPages);
279 Page::refreshPlugins(); 270 Page::refreshPlugins();
280 } 271 }
281 272
282 void decommitFreeableMemory() 273 void decommitFreeableMemory()
283 { 274 {
284 WTF::Partitions::decommitFreeableMemory(); 275 WTF::Partitions::decommitFreeableMemory();
285 } 276 }
286 277
287 } // namespace blink 278 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/exported/Platform.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698