| 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #include "core/inspector/ScriptCallStack.h" | 54 #include "core/inspector/ScriptCallStack.h" |
| 55 #include "core/workers/WorkerGlobalScope.h" | 55 #include "core/workers/WorkerGlobalScope.h" |
| 56 #include "platform/EventDispatchForbiddenScope.h" | 56 #include "platform/EventDispatchForbiddenScope.h" |
| 57 #include "platform/RuntimeEnabledFeatures.h" | 57 #include "platform/RuntimeEnabledFeatures.h" |
| 58 #include "platform/TraceEvent.h" | 58 #include "platform/TraceEvent.h" |
| 59 #include "public/platform/Platform.h" | 59 #include "public/platform/Platform.h" |
| 60 #include "public/platform/WebScheduler.h" | 60 #include "public/platform/WebScheduler.h" |
| 61 #include "public/platform/WebThread.h" | 61 #include "public/platform/WebThread.h" |
| 62 #include "wtf/AddressSanitizer.h" | 62 #include "wtf/AddressSanitizer.h" |
| 63 #include "wtf/ArrayBufferContents.h" | 63 #include "wtf/ArrayBufferContents.h" |
| 64 #include "wtf/LeakAnnotations.h" |
| 64 #include "wtf/RefPtr.h" | 65 #include "wtf/RefPtr.h" |
| 65 #include "wtf/text/WTFString.h" | 66 #include "wtf/text/WTFString.h" |
| 66 #include <v8-debug.h> | 67 #include <v8-debug.h> |
| 67 #include <v8-profiler.h> | 68 #include <v8-profiler.h> |
| 68 | 69 |
| 69 namespace blink { | 70 namespace blink { |
| 70 | 71 |
| 71 static Frame* findFrame(v8::Isolate* isolate, v8::Local<v8::Object> host, v8::Lo
cal<v8::Value> data) | 72 static Frame* findFrame(v8::Isolate* isolate, v8::Local<v8::Object> host, v8::Lo
cal<v8::Value> data) |
| 72 { | 73 { |
| 73 const WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data); | 74 const WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 enteredWindow->document()->reportException(event.release(), scriptId, ca
llStack, accessControlStatus); | 185 enteredWindow->document()->reportException(event.release(), scriptId, ca
llStack, accessControlStatus); |
| 185 } else { | 186 } else { |
| 186 enteredWindow->document()->reportException(event.release(), scriptId, ca
llStack, accessControlStatus); | 187 enteredWindow->document()->reportException(event.release(), scriptId, ca
llStack, accessControlStatus); |
| 187 } | 188 } |
| 188 } | 189 } |
| 189 | 190 |
| 190 namespace { | 191 namespace { |
| 191 | 192 |
| 192 static RejectedPromises& rejectedPromisesOnMainThread() | 193 static RejectedPromises& rejectedPromisesOnMainThread() |
| 193 { | 194 { |
| 195 WTF_ANNOTATE_SCOPED_MEMORY_LEAK; |
| 194 ASSERT(isMainThread()); | 196 ASSERT(isMainThread()); |
| 195 DEFINE_STATIC_LOCAL(RefPtrWillBePersistent<RejectedPromises>, rejectedPromis
es, (adoptRefWillBeNoop(new RejectedPromises()))); | 197 DEFINE_STATIC_LOCAL(RefPtrWillBePersistent<RejectedPromises>, rejectedPromis
es, (RejectedPromises::create())); |
| 196 return *rejectedPromises; | 198 return *rejectedPromises; |
| 197 } | 199 } |
| 198 | 200 |
| 199 } // namespace | 201 } // namespace |
| 200 | 202 |
| 201 void V8Initializer::reportRejectedPromisesOnMainThread() | 203 void V8Initializer::reportRejectedPromisesOnMainThread() |
| 202 { | 204 { |
| 203 rejectedPromisesOnMainThread().processQueue(); | 205 rejectedPromisesOnMainThread().processQueue(); |
| 204 } | 206 } |
| 205 | 207 |
| 208 void V8Initializer::disposeRejectedPromisesOnMainThread() |
| 209 { |
| 210 rejectedPromisesOnMainThread().dispose(); |
| 211 } |
| 212 |
| 206 static void promiseRejectHandlerInMainThread(v8::PromiseRejectMessage data) | 213 static void promiseRejectHandlerInMainThread(v8::PromiseRejectMessage data) |
| 207 { | 214 { |
| 208 ASSERT(isMainThread()); | 215 ASSERT(isMainThread()); |
| 209 if (data.GetEvent() == v8::kPromiseHandlerAddedAfterReject) { | 216 if (data.GetEvent() == v8::kPromiseHandlerAddedAfterReject) { |
| 210 rejectedPromisesOnMainThread().handlerAdded(data); | 217 rejectedPromisesOnMainThread().handlerAdded(data); |
| 211 return; | 218 return; |
| 212 } | 219 } |
| 213 | 220 |
| 214 ASSERT(data.GetEvent() == v8::kPromiseRejectWithNoHandler); | 221 ASSERT(data.GetEvent() == v8::kPromiseRejectWithNoHandler); |
| 215 | 222 |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 | 466 |
| 460 v8::V8::AddMessageListener(messageHandlerInWorker); | 467 v8::V8::AddMessageListener(messageHandlerInWorker); |
| 461 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); | 468 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); |
| 462 | 469 |
| 463 uint32_t here; | 470 uint32_t here; |
| 464 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi
ze / sizeof(uint32_t*))); | 471 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi
ze / sizeof(uint32_t*))); |
| 465 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); | 472 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); |
| 466 } | 473 } |
| 467 | 474 |
| 468 } // namespace blink | 475 } // namespace blink |
| OLD | NEW |