| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // we've ever seen. | 134 // we've ever seen. |
| 135 DEFINE_STATIC_LOCAL(EnumerationHistogram, committedSizeHistogram, ("Partitio
nAlloc.CommittedSize", supportedMaxSizeInMB)); | 135 DEFINE_STATIC_LOCAL(EnumerationHistogram, committedSizeHistogram, ("Partitio
nAlloc.CommittedSize", supportedMaxSizeInMB)); |
| 136 committedSizeHistogram.count(sizeInMB); | 136 committedSizeHistogram.count(sizeInMB); |
| 137 } | 137 } |
| 138 | 138 |
| 139 static void callOnMainThreadFunction(WTF::MainThreadFunction function, void* con
text) | 139 static void callOnMainThreadFunction(WTF::MainThreadFunction function, void* con
text) |
| 140 { | 140 { |
| 141 Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FROM_H
ERE, threadSafeBind(function, AllowCrossThreadAccess(context))); | 141 Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FROM_H
ERE, threadSafeBind(function, AllowCrossThreadAccess(context))); |
| 142 } | 142 } |
| 143 | 143 |
| 144 static void adjustAmountOfExternalAllocatedMemory(int size) | |
| 145 { | |
| 146 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(size); | |
| 147 } | |
| 148 | |
| 149 void initializeWithoutV8(Platform* platform) | 144 void initializeWithoutV8(Platform* platform) |
| 150 { | 145 { |
| 151 ASSERT(!s_webKitInitialized); | 146 ASSERT(!s_webKitInitialized); |
| 152 s_webKitInitialized = true; | 147 s_webKitInitialized = true; |
| 153 | 148 |
| 154 WTF::Partitions::initialize(maxObservedSizeFunction); | 149 WTF::Partitions::initialize(maxObservedSizeFunction); |
| 155 WTF::initialize(adjustAmountOfExternalAllocatedMemory); | 150 WTF::initialize(); |
| 156 WTF::initializeMainThread(callOnMainThreadFunction); | 151 WTF::initializeMainThread(callOnMainThreadFunction); |
| 157 | 152 |
| 158 ASSERT(platform); | 153 ASSERT(platform); |
| 159 Platform::initialize(platform); | 154 Platform::initialize(platform); |
| 160 Heap::init(); | 155 Heap::init(); |
| 161 | 156 |
| 162 ThreadState::attachMainThread(); | 157 ThreadState::attachMainThread(); |
| 163 // currentThread() is null if we are running on a thread without a message l
oop. | 158 // currentThread() is null if we are running on a thread without a message l
oop. |
| 164 if (WebThread* currentThread = platform->currentThread()) { | 159 if (WebThread* currentThread = platform->currentThread()) { |
| 165 ASSERT(!s_gcTaskRunner); | 160 ASSERT(!s_gcTaskRunner); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 ASSERT(!reloadPages); | 273 ASSERT(!reloadPages); |
| 279 Page::refreshPlugins(); | 274 Page::refreshPlugins(); |
| 280 } | 275 } |
| 281 | 276 |
| 282 void decommitFreeableMemory() | 277 void decommitFreeableMemory() |
| 283 { | 278 { |
| 284 WTF::Partitions::decommitFreeableMemory(); | 279 WTF::Partitions::decommitFreeableMemory(); |
| 285 } | 280 } |
| 286 | 281 |
| 287 } // namespace blink | 282 } // namespace blink |
| OLD | NEW |