| OLD | NEW |
| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 platform->registerMemoryDumpProvider(WebCacheMemoryDumpProvider::instanc
e(), "MemoryCache"); | 127 platform->registerMemoryDumpProvider(WebCacheMemoryDumpProvider::instanc
e(), "MemoryCache"); |
| 128 platform->registerMemoryDumpProvider(FontCacheMemoryDumpProvider::instan
ce(), "FontCaches"); | 128 platform->registerMemoryDumpProvider(FontCacheMemoryDumpProvider::instan
ce(), "FontCaches"); |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 | 131 |
| 132 v8::Isolate* mainThreadIsolate() | 132 v8::Isolate* mainThreadIsolate() |
| 133 { | 133 { |
| 134 return V8PerIsolateData::mainThreadIsolate(); | 134 return V8PerIsolateData::mainThreadIsolate(); |
| 135 } | 135 } |
| 136 | 136 |
| 137 static double currentTimeFunction() | |
| 138 { | |
| 139 return Platform::current()->currentTimeSeconds(); | |
| 140 } | |
| 141 | |
| 142 static double monotonicallyIncreasingTimeFunction() | |
| 143 { | |
| 144 return Platform::current()->monotonicallyIncreasingTimeSeconds(); | |
| 145 } | |
| 146 | |
| 147 static void maxObservedSizeFunction(size_t sizeInMB) | 137 static void maxObservedSizeFunction(size_t sizeInMB) |
| 148 { | 138 { |
| 149 const size_t supportedMaxSizeInMB = 4 * 1024; | 139 const size_t supportedMaxSizeInMB = 4 * 1024; |
| 150 if (sizeInMB >= supportedMaxSizeInMB) | 140 if (sizeInMB >= supportedMaxSizeInMB) |
| 151 sizeInMB = supportedMaxSizeInMB - 1; | 141 sizeInMB = supportedMaxSizeInMB - 1; |
| 152 | 142 |
| 153 // Send a UseCounter only when we see the highest memory usage | 143 // Send a UseCounter only when we see the highest memory usage |
| 154 // we've ever seen. | 144 // we've ever seen. |
| 155 DEFINE_STATIC_LOCAL(EnumerationHistogram, committedSizeHistogram, ("Partitio
nAlloc.CommittedSize", supportedMaxSizeInMB)); | 145 DEFINE_STATIC_LOCAL(EnumerationHistogram, committedSizeHistogram, ("Partitio
nAlloc.CommittedSize", supportedMaxSizeInMB)); |
| 156 committedSizeHistogram.count(sizeInMB); | 146 committedSizeHistogram.count(sizeInMB); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 168 | 158 |
| 169 void initializeWithoutV8(Platform* platform) | 159 void initializeWithoutV8(Platform* platform) |
| 170 { | 160 { |
| 171 ASSERT(!s_webKitInitialized); | 161 ASSERT(!s_webKitInitialized); |
| 172 s_webKitInitialized = true; | 162 s_webKitInitialized = true; |
| 173 | 163 |
| 174 WTF::Partitions::initialize(maxObservedSizeFunction); | 164 WTF::Partitions::initialize(maxObservedSizeFunction); |
| 175 ASSERT(platform); | 165 ASSERT(platform); |
| 176 Platform::initialize(platform); | 166 Platform::initialize(platform); |
| 177 | 167 |
| 178 WTF::initialize(currentTimeFunction, monotonicallyIncreasingTimeFunction, ad
justAmountOfExternalAllocatedMemory); | 168 WTF::initialize(adjustAmountOfExternalAllocatedMemory); |
| 179 WTF::initializeMainThread(callOnMainThreadFunction); | 169 WTF::initializeMainThread(callOnMainThreadFunction); |
| 180 Heap::init(); | 170 Heap::init(); |
| 181 | 171 |
| 182 ThreadState::attachMainThread(); | 172 ThreadState::attachMainThread(); |
| 183 // currentThread() is null if we are running on a thread without a message l
oop. | 173 // currentThread() is null if we are running on a thread without a message l
oop. |
| 184 if (WebThread* currentThread = platform->currentThread()) { | 174 if (WebThread* currentThread = platform->currentThread()) { |
| 185 ASSERT(!s_gcTaskRunner); | 175 ASSERT(!s_gcTaskRunner); |
| 186 s_gcTaskRunner = new GCTaskRunner(currentThread); | 176 s_gcTaskRunner = new GCTaskRunner(currentThread); |
| 187 } | 177 } |
| 188 | 178 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 ASSERT(!reloadPages); | 298 ASSERT(!reloadPages); |
| 309 Page::refreshPlugins(); | 299 Page::refreshPlugins(); |
| 310 } | 300 } |
| 311 | 301 |
| 312 void decommitFreeableMemory() | 302 void decommitFreeableMemory() |
| 313 { | 303 { |
| 314 WTF::Partitions::decommitFreeableMemory(); | 304 WTF::Partitions::decommitFreeableMemory(); |
| 315 } | 305 } |
| 316 | 306 |
| 317 } // namespace blink | 307 } // namespace blink |
| OLD | NEW |