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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 #include "wtf/CryptographicallyRandomNumber.h" | 60 #include "wtf/CryptographicallyRandomNumber.h" |
61 #include "wtf/MainThread.h" | 61 #include "wtf/MainThread.h" |
62 #include "wtf/Partitions.h" | 62 #include "wtf/Partitions.h" |
63 #include "wtf/WTF.h" | 63 #include "wtf/WTF.h" |
64 #include "wtf/text/AtomicString.h" | 64 #include "wtf/text/AtomicString.h" |
65 #include "wtf/text/TextEncoding.h" | 65 #include "wtf/text/TextEncoding.h" |
66 #include <v8.h> | 66 #include <v8.h> |
67 | 67 |
68 namespace blink { | 68 namespace blink { |
69 | 69 |
70 namespace { | 70 namespace helpers { |
jochen (gone - plz use gerrit)
2015/07/16 13:46:54
why this change?
Daniel Bratell
2015/07/16 13:57:11
Via the precompiled headers (Document.h I assume)
| |
71 | 71 |
72 class EndOfTaskRunner : public WebThread::TaskObserver { | 72 class EndOfTaskRunner : public WebThread::TaskObserver { |
73 public: | 73 public: |
74 void willProcessTask() override | 74 void willProcessTask() override |
75 { | 75 { |
76 AnimationClock::notifyTaskStart(); | 76 AnimationClock::notifyTaskStart(); |
77 } | 77 } |
78 void didProcessTask() override | 78 void didProcessTask() override |
79 { | 79 { |
80 Microtask::performCheckpoint(mainThreadIsolate()); | 80 Microtask::performCheckpoint(mainThreadIsolate()); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 | 116 |
117 V8Initializer::initializeMainThreadIfNeeded(); | 117 V8Initializer::initializeMainThreadIfNeeded(); |
118 | 118 |
119 s_isolateInterruptor = new V8IsolateInterruptor(V8PerIsolateData::mainThread Isolate()); | 119 s_isolateInterruptor = new V8IsolateInterruptor(V8PerIsolateData::mainThread Isolate()); |
120 ThreadState::current()->addInterruptor(s_isolateInterruptor); | 120 ThreadState::current()->addInterruptor(s_isolateInterruptor); |
121 ThreadState::current()->registerTraceDOMWrappers(V8PerIsolateData::mainThrea dIsolate(), V8GCController::traceDOMWrappers); | 121 ThreadState::current()->registerTraceDOMWrappers(V8PerIsolateData::mainThrea dIsolate(), V8GCController::traceDOMWrappers); |
122 | 122 |
123 // currentThread is null if we are running on a thread without a message loo p. | 123 // currentThread is null if we are running on a thread without a message loo p. |
124 if (WebThread* currentThread = platform->currentThread()) { | 124 if (WebThread* currentThread = platform->currentThread()) { |
125 ASSERT(!s_endOfTaskRunner); | 125 ASSERT(!s_endOfTaskRunner); |
126 s_endOfTaskRunner = new EndOfTaskRunner; | 126 s_endOfTaskRunner = new helpers::EndOfTaskRunner; |
127 currentThread->addTaskObserver(s_endOfTaskRunner); | 127 currentThread->addTaskObserver(s_endOfTaskRunner); |
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() | 136 static double currentTimeFunction() |
(...skipping 16 matching lines...) Expand all Loading... | |
153 Platform::current()->histogramEnumeration(name, sample, boundaryValue); | 153 Platform::current()->histogramEnumeration(name, sample, boundaryValue); |
154 } | 154 } |
155 | 155 |
156 static void cryptographicallyRandomValues(unsigned char* buffer, size_t length) | 156 static void cryptographicallyRandomValues(unsigned char* buffer, size_t length) |
157 { | 157 { |
158 Platform::current()->cryptographicallyRandomValues(buffer, length); | 158 Platform::current()->cryptographicallyRandomValues(buffer, length); |
159 } | 159 } |
160 | 160 |
161 static void callOnMainThreadFunction(WTF::MainThreadFunction function, void* con text) | 161 static void callOnMainThreadFunction(WTF::MainThreadFunction function, void* con text) |
162 { | 162 { |
163 Platform::current()->mainThread()->postTask(FROM_HERE, new MainThreadTaskRun ner(function, context)); | 163 Platform::current()->mainThread()->postTask(FROM_HERE, new helpers::MainThre adTaskRunner(function, context)); |
164 } | 164 } |
165 | 165 |
166 static void adjustAmountOfExternalAllocatedMemory(int size) | 166 static void adjustAmountOfExternalAllocatedMemory(int size) |
167 { | 167 { |
168 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(size); | 168 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(size); |
169 } | 169 } |
170 | 170 |
171 void initializeWithoutV8(Platform* platform) | 171 void initializeWithoutV8(Platform* platform) |
172 { | 172 { |
173 ASSERT(!s_webKitInitialized); | 173 ASSERT(!s_webKitInitialized); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
294 ASSERT(!reloadPages); | 294 ASSERT(!reloadPages); |
295 Page::refreshPlugins(); | 295 Page::refreshPlugins(); |
296 } | 296 } |
297 | 297 |
298 void decommitFreeableMemory() | 298 void decommitFreeableMemory() |
299 { | 299 { |
300 WTF::Partitions::decommitFreeableMemory(); | 300 WTF::Partitions::decommitFreeableMemory(); |
301 } | 301 } |
302 | 302 |
303 } // namespace blink | 303 } // namespace blink |
OLD | NEW |