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

Side by Side Diff: third_party/WebKit/Source/platform/exported/Platform.cpp

Issue 2043753002: Declarative resource hints go through mojo IPC to //content Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove gmocking + add another browser test 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "base/threading/thread_task_runner_handle.h" 31 #include "base/threading/thread_task_runner_handle.h"
32 #include "base/trace_event/memory_dump_manager.h" 32 #include "base/trace_event/memory_dump_manager.h"
33 #include "platform/Histogram.h" 33 #include "platform/Histogram.h"
34 #include "platform/MemoryCacheDumpProvider.h" 34 #include "platform/MemoryCacheDumpProvider.h"
35 #include "platform/PartitionAllocMemoryDumpProvider.h" 35 #include "platform/PartitionAllocMemoryDumpProvider.h"
36 #include "platform/PlatformMojoServices.h"
36 #include "platform/fonts/FontCacheMemoryDumpProvider.h" 37 #include "platform/fonts/FontCacheMemoryDumpProvider.h"
37 #include "platform/heap/BlinkGCMemoryDumpProvider.h" 38 #include "platform/heap/BlinkGCMemoryDumpProvider.h"
38 #include "platform/heap/GCTaskRunner.h" 39 #include "platform/heap/GCTaskRunner.h"
39 #include "public/platform/Platform.h" 40 #include "public/platform/Platform.h"
40 #include "public/platform/ServiceRegistry.h" 41 #include "public/platform/ServiceRegistry.h"
41 #include "public/platform/WebPrerenderingSupport.h" 42 #include "public/platform/WebPrerenderingSupport.h"
43 #include "public/platform/WebPrescientNetworking.h"
42 #include "wtf/HashMap.h" 44 #include "wtf/HashMap.h"
43 45
44 namespace blink { 46 namespace blink {
45 47
46 static Platform* s_platform = nullptr; 48 static Platform* s_platform = nullptr;
47 49
48 static GCTaskRunner* s_gcTaskRunner = nullptr; 50 static GCTaskRunner* s_gcTaskRunner = nullptr;
49 51
50 Platform::Platform() 52 Platform::Platform()
51 : m_mainThread(0) 53 : m_mainThread(0)
52 { 54 {
53 } 55 }
54 56
57 Platform::~Platform() = default;
58
55 static void maxObservedSizeFunction(size_t sizeInMB) 59 static void maxObservedSizeFunction(size_t sizeInMB)
56 { 60 {
57 const size_t supportedMaxSizeInMB = 4 * 1024; 61 const size_t supportedMaxSizeInMB = 4 * 1024;
58 if (sizeInMB >= supportedMaxSizeInMB) 62 if (sizeInMB >= supportedMaxSizeInMB)
59 sizeInMB = supportedMaxSizeInMB - 1; 63 sizeInMB = supportedMaxSizeInMB - 1;
60 64
61 // Send a UseCounter only when we see the highest memory usage 65 // Send a UseCounter only when we see the highest memory usage
62 // we've ever seen. 66 // we've ever seen.
63 DEFINE_STATIC_LOCAL(EnumerationHistogram, committedSizeHistogram, ("Partitio nAlloc.CommittedSize", supportedMaxSizeInMB)); 67 DEFINE_STATIC_LOCAL(EnumerationHistogram, committedSizeHistogram, ("Partitio nAlloc.CommittedSize", supportedMaxSizeInMB));
64 committedSizeHistogram.count(sizeInMB); 68 committedSizeHistogram.count(sizeInMB);
(...skipping 21 matching lines...) Expand all
86 ThreadState::attachMainThread(); 90 ThreadState::attachMainThread();
87 91
88 // TODO(ssid): remove this check after fixing crbug.com/486782. 92 // TODO(ssid): remove this check after fixing crbug.com/486782.
89 if (s_platform->m_mainThread) { 93 if (s_platform->m_mainThread) {
90 ASSERT(!s_gcTaskRunner); 94 ASSERT(!s_gcTaskRunner);
91 s_gcTaskRunner = new GCTaskRunner(s_platform->m_mainThread); 95 s_gcTaskRunner = new GCTaskRunner(s_platform->m_mainThread);
92 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvide r(PartitionAllocMemoryDumpProvider::instance(), "PartitionAlloc", base::ThreadTa skRunnerHandle::Get()); 96 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvide r(PartitionAllocMemoryDumpProvider::instance(), "PartitionAlloc", base::ThreadTa skRunnerHandle::Get());
93 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvide r(FontCacheMemoryDumpProvider::instance(), "FontCaches", base::ThreadTaskRunnerH andle::Get()); 97 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvide r(FontCacheMemoryDumpProvider::instance(), "FontCaches", base::ThreadTaskRunnerH andle::Get());
94 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvide r(MemoryCacheDumpProvider::instance(), "MemoryCache", base::ThreadTaskRunnerHand le::Get()); 98 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvide r(MemoryCacheDumpProvider::instance(), "MemoryCache", base::ThreadTaskRunnerHand le::Get());
95 } 99 }
100 s_platform->m_mojoServices.reset(new PlatformMojoServices);
96 } 101 }
97 102
98 void Platform::shutdown() 103 void Platform::shutdown()
99 { 104 {
100 ASSERT(isMainThread()); 105 ASSERT(isMainThread());
106 s_platform->m_mojoServices.reset();
101 if (s_platform->m_mainThread) { 107 if (s_platform->m_mainThread) {
102 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvi der(FontCacheMemoryDumpProvider::instance()); 108 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvi der(FontCacheMemoryDumpProvider::instance());
103 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvi der(PartitionAllocMemoryDumpProvider::instance()); 109 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvi der(PartitionAllocMemoryDumpProvider::instance());
104 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvi der(BlinkGCMemoryDumpProvider::instance()); 110 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvi der(BlinkGCMemoryDumpProvider::instance());
105 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvi der(MemoryCacheDumpProvider::instance()); 111 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvi der(MemoryCacheDumpProvider::instance());
106 112
107 ASSERT(s_gcTaskRunner); 113 ASSERT(s_gcTaskRunner);
108 delete s_gcTaskRunner; 114 delete s_gcTaskRunner;
109 s_gcTaskRunner = nullptr; 115 s_gcTaskRunner = nullptr;
110 } 116 }
(...skipping 26 matching lines...) Expand all
137 WebThread* Platform::mainThread() const 143 WebThread* Platform::mainThread() const
138 { 144 {
139 return m_mainThread; 145 return m_mainThread;
140 } 146 }
141 147
142 ServiceRegistry* Platform::serviceRegistry() 148 ServiceRegistry* Platform::serviceRegistry()
143 { 149 {
144 return ServiceRegistry::getEmptyServiceRegistry(); 150 return ServiceRegistry::getEmptyServiceRegistry();
145 } 151 }
146 152
153 PlatformMojoServices* Platform::mojoServices()
154 {
155 return m_mojoServices.get();
156 }
157
147 } // namespace blink 158 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698