| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 #include "wtf/Assertions.h" | 59 #include "wtf/Assertions.h" |
| 60 #include "wtf/CryptographicallyRandomNumber.h" | 60 #include "wtf/CryptographicallyRandomNumber.h" |
| 61 #include "wtf/MainThread.h" | 61 #include "wtf/MainThread.h" |
| 62 #include "wtf/WTF.h" | 62 #include "wtf/WTF.h" |
| 63 #include "wtf/text/AtomicString.h" | 63 #include "wtf/text/AtomicString.h" |
| 64 #include "wtf/text/TextEncoding.h" | 64 #include "wtf/text/TextEncoding.h" |
| 65 #include <v8.h> | 65 #include <v8.h> |
| 66 | 66 |
| 67 namespace blink { | 67 namespace blink { |
| 68 | 68 |
| 69 namespace { | 69 namespace helpers { |
| 70 | 70 |
| 71 class EndOfTaskRunner : public WebThread::TaskObserver { | 71 class EndOfTaskRunner : public WebThread::TaskObserver { |
| 72 public: | 72 public: |
| 73 virtual void willProcessTask() override | 73 virtual void willProcessTask() override |
| 74 { | 74 { |
| 75 AnimationClock::notifyTaskStart(); | 75 AnimationClock::notifyTaskStart(); |
| 76 } | 76 } |
| 77 virtual void didProcessTask() override | 77 virtual void didProcessTask() override |
| 78 { | 78 { |
| 79 Microtask::performCheckpoint(mainThreadIsolate()); | 79 Microtask::performCheckpoint(mainThreadIsolate()); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 V8Initializer::initializeMainThreadIfNeeded(); | 116 V8Initializer::initializeMainThreadIfNeeded(); |
| 117 | 117 |
| 118 s_isolateInterruptor = new V8IsolateInterruptor(V8PerIsolateData::mainThread
Isolate()); | 118 s_isolateInterruptor = new V8IsolateInterruptor(V8PerIsolateData::mainThread
Isolate()); |
| 119 ThreadState::current()->addInterruptor(s_isolateInterruptor); | 119 ThreadState::current()->addInterruptor(s_isolateInterruptor); |
| 120 ThreadState::current()->registerTraceDOMWrappers(V8PerIsolateData::mainThrea
dIsolate(), V8GCController::traceDOMWrappers); | 120 ThreadState::current()->registerTraceDOMWrappers(V8PerIsolateData::mainThrea
dIsolate(), V8GCController::traceDOMWrappers); |
| 121 | 121 |
| 122 // currentThread is null if we are running on a thread without a message loo
p. | 122 // currentThread is null if we are running on a thread without a message loo
p. |
| 123 if (WebThread* currentThread = platform->currentThread()) { | 123 if (WebThread* currentThread = platform->currentThread()) { |
| 124 ASSERT(!s_endOfTaskRunner); | 124 ASSERT(!s_endOfTaskRunner); |
| 125 s_endOfTaskRunner = new EndOfTaskRunner; | 125 s_endOfTaskRunner = new helpers::EndOfTaskRunner; |
| 126 currentThread->addTaskObserver(s_endOfTaskRunner); | 126 currentThread->addTaskObserver(s_endOfTaskRunner); |
| 127 } | 127 } |
| 128 } | 128 } |
| 129 | 129 |
| 130 v8::Isolate* mainThreadIsolate() | 130 v8::Isolate* mainThreadIsolate() |
| 131 { | 131 { |
| 132 return V8PerIsolateData::mainThreadIsolate(); | 132 return V8PerIsolateData::mainThreadIsolate(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 static double currentTimeFunction() | 135 static double currentTimeFunction() |
| (...skipping 16 matching lines...) Expand all Loading... |
| 152 Platform::current()->histogramEnumeration(name, sample, boundaryValue); | 152 Platform::current()->histogramEnumeration(name, sample, boundaryValue); |
| 153 } | 153 } |
| 154 | 154 |
| 155 static void cryptographicallyRandomValues(unsigned char* buffer, size_t length) | 155 static void cryptographicallyRandomValues(unsigned char* buffer, size_t length) |
| 156 { | 156 { |
| 157 Platform::current()->cryptographicallyRandomValues(buffer, length); | 157 Platform::current()->cryptographicallyRandomValues(buffer, length); |
| 158 } | 158 } |
| 159 | 159 |
| 160 static void callOnMainThreadFunction(WTF::MainThreadFunction function, void* con
text) | 160 static void callOnMainThreadFunction(WTF::MainThreadFunction function, void* con
text) |
| 161 { | 161 { |
| 162 Platform::current()->mainThread()->postTask(FROM_HERE, new MainThreadTaskRun
ner(function, context)); | 162 Platform::current()->mainThread()->postTask(FROM_HERE, new helpers::MainThre
adTaskRunner(function, context)); |
| 163 } | 163 } |
| 164 | 164 |
| 165 void initializeWithoutV8(Platform* platform) | 165 void initializeWithoutV8(Platform* platform) |
| 166 { | 166 { |
| 167 ASSERT(!s_webKitInitialized); | 167 ASSERT(!s_webKitInitialized); |
| 168 s_webKitInitialized = true; | 168 s_webKitInitialized = true; |
| 169 | 169 |
| 170 ASSERT(platform); | 170 ASSERT(platform); |
| 171 Platform::initialize(platform); | 171 Platform::initialize(platform); |
| 172 | 172 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 #endif // !LOG_DISABLED | 283 #endif // !LOG_DISABLED |
| 284 } | 284 } |
| 285 | 285 |
| 286 void resetPluginCache(bool reloadPages) | 286 void resetPluginCache(bool reloadPages) |
| 287 { | 287 { |
| 288 ASSERT(!reloadPages); | 288 ASSERT(!reloadPages); |
| 289 Page::refreshPlugins(); | 289 Page::refreshPlugins(); |
| 290 } | 290 } |
| 291 | 291 |
| 292 } // namespace blink | 292 } // namespace blink |
| OLD | NEW |