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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 platform->registerMemoryDumpProvider(WebCacheMemoryDumpProvider::instanc
e(), "MemoryCache"); | 126 platform->registerMemoryDumpProvider(WebCacheMemoryDumpProvider::instanc
e(), "MemoryCache"); |
127 platform->registerMemoryDumpProvider(FontCacheMemoryDumpProvider::instan
ce(), "FontCaches"); | 127 platform->registerMemoryDumpProvider(FontCacheMemoryDumpProvider::instan
ce(), "FontCaches"); |
128 } | 128 } |
129 } | 129 } |
130 | 130 |
131 v8::Isolate* mainThreadIsolate() | 131 v8::Isolate* mainThreadIsolate() |
132 { | 132 { |
133 return V8PerIsolateData::mainThreadIsolate(); | 133 return V8PerIsolateData::mainThreadIsolate(); |
134 } | 134 } |
135 | 135 |
136 static double currentTimeFunction() | |
137 { | |
138 return Platform::current()->currentTimeSeconds(); | |
139 } | |
140 | |
141 static double monotonicallyIncreasingTimeFunction() | |
142 { | |
143 return Platform::current()->monotonicallyIncreasingTimeSeconds(); | |
144 } | |
145 | |
146 static double systemTraceTimeFunction() | |
147 { | |
148 return Platform::current()->systemTraceTime(); | |
149 } | |
150 | |
151 static void histogramEnumerationFunction(const char* name, int sample, int bound
aryValue) | 136 static void histogramEnumerationFunction(const char* name, int sample, int bound
aryValue) |
152 { | 137 { |
153 Platform::current()->histogramEnumeration(name, sample, boundaryValue); | 138 Platform::current()->histogramEnumeration(name, sample, boundaryValue); |
154 } | 139 } |
155 | 140 |
156 static void cryptographicallyRandomValues(unsigned char* buffer, size_t length) | 141 static void cryptographicallyRandomValues(unsigned char* buffer, size_t length) |
157 { | 142 { |
158 Platform::current()->cryptographicallyRandomValues(buffer, length); | 143 Platform::current()->cryptographicallyRandomValues(buffer, length); |
159 } | 144 } |
160 | 145 |
161 static void callOnMainThreadFunction(WTF::MainThreadFunction function, void* con
text) | 146 static void callOnMainThreadFunction(WTF::MainThreadFunction function, void* con
text) |
162 { | 147 { |
163 Platform::current()->mainThread()->taskRunner()->postTask(BLINK_FROM_HERE, n
ew MainThreadTaskRunner(function, context)); | 148 Platform::current()->mainThread()->taskRunner()->postTask(BLINK_FROM_HERE, n
ew MainThreadTaskRunner(function, context)); |
164 } | 149 } |
165 | 150 |
166 static void adjustAmountOfExternalAllocatedMemory(int size) | 151 static void adjustAmountOfExternalAllocatedMemory(int size) |
167 { | 152 { |
168 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(size); | 153 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(size); |
169 } | 154 } |
170 | 155 |
171 void initializeWithoutV8(Platform* platform) | 156 void initializeWithoutV8(Platform* platform) |
172 { | 157 { |
173 ASSERT(!s_webKitInitialized); | 158 ASSERT(!s_webKitInitialized); |
174 s_webKitInitialized = true; | 159 s_webKitInitialized = true; |
175 | 160 |
176 ASSERT(platform); | 161 ASSERT(platform); |
177 Platform::initialize(platform); | 162 Platform::initialize(platform); |
178 | 163 |
179 WTF::setRandomSource(cryptographicallyRandomValues); | 164 WTF::setRandomSource(cryptographicallyRandomValues); |
180 WTF::initialize(currentTimeFunction, monotonicallyIncreasingTimeFunction, sy
stemTraceTimeFunction, histogramEnumerationFunction, adjustAmountOfExternalAlloc
atedMemory); | 165 WTF::initialize(histogramEnumerationFunction, adjustAmountOfExternalAllocate
dMemory); |
181 WTF::initializeMainThread(callOnMainThreadFunction); | 166 WTF::initializeMainThread(callOnMainThreadFunction); |
182 Heap::init(); | 167 Heap::init(); |
183 | 168 |
184 ThreadState::attachMainThread(); | 169 ThreadState::attachMainThread(); |
185 // currentThread() is null if we are running on a thread without a message l
oop. | 170 // currentThread() is null if we are running on a thread without a message l
oop. |
186 if (WebThread* currentThread = platform->currentThread()) { | 171 if (WebThread* currentThread = platform->currentThread()) { |
187 ASSERT(!s_gcTaskRunner); | 172 ASSERT(!s_gcTaskRunner); |
188 s_gcTaskRunner = new GCTaskRunner(currentThread); | 173 s_gcTaskRunner = new GCTaskRunner(currentThread); |
189 } | 174 } |
190 | 175 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 ASSERT(!reloadPages); | 297 ASSERT(!reloadPages); |
313 Page::refreshPlugins(); | 298 Page::refreshPlugins(); |
314 } | 299 } |
315 | 300 |
316 void decommitFreeableMemory() | 301 void decommitFreeableMemory() |
317 { | 302 { |
318 WTF::Partitions::decommitFreeableMemory(); | 303 WTF::Partitions::decommitFreeableMemory(); |
319 } | 304 } |
320 | 305 |
321 } // namespace blink | 306 } // namespace blink |
OLD | NEW |