Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: Source/bindings/core/v8/V8Initializer.cpp

Issue 1097273002: Refactor core/v8/* methods to take isolate as first parameter (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/bindings/core/v8/NPV8Object.cpp ('k') | Source/bindings/core/v8/V8NPObject.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/ArrayBufferContents.h" 62 #include "wtf/ArrayBufferContents.h"
63 #include "wtf/RefPtr.h" 63 #include "wtf/RefPtr.h"
64 #include "wtf/text/WTFString.h" 64 #include "wtf/text/WTFString.h"
65 #include <v8-debug.h> 65 #include <v8-debug.h>
66 66
67 namespace blink { 67 namespace blink {
68 68
69 static Frame* findFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> data, v 8::Isolate* isolate) 69 static Frame* findFrame(v8::Isolate* isolate, v8::Local<v8::Object> host, v8::Lo cal<v8::Value> data)
70 { 70 {
71 const WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data); 71 const WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data);
72 72
73 if (V8Window::wrapperTypeInfo.equals(type)) { 73 if (V8Window::wrapperTypeInfo.equals(type)) {
74 v8::Handle<v8::Object> windowWrapper = V8Window::findInstanceInPrototype Chain(host, isolate); 74 v8::Handle<v8::Object> windowWrapper = V8Window::findInstanceInPrototype Chain(host, isolate);
75 if (windowWrapper.IsEmpty()) 75 if (windowWrapper.IsEmpty())
76 return 0; 76 return 0;
77 return V8Window::toImpl(windowWrapper)->frame(); 77 return V8Window::toImpl(windowWrapper)->frame();
78 } 78 }
79 79
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 ++columnNumber; 288 ++columnNumber;
289 // message->Get() can be empty here. https://crbug.com/450330 289 // message->Get() can be empty here. https://crbug.com/450330
290 errorMessage = toCoreStringWithNullCheck(message->Get()); 290 errorMessage = toCoreStringWithNullCheck(message->Get());
291 } 291 }
292 scriptController->rejectedPromises()->add(scriptState, data, errorMessage, r esourceName, scriptId, lineNumber, columnNumber, nullptr); 292 scriptController->rejectedPromises()->add(scriptState, data, errorMessage, r esourceName, scriptId, lineNumber, columnNumber, nullptr);
293 } 293 }
294 294
295 static void failedAccessCheckCallbackInMainThread(v8::Local<v8::Object> host, v8 ::AccessType type, v8::Local<v8::Value> data) 295 static void failedAccessCheckCallbackInMainThread(v8::Local<v8::Object> host, v8 ::AccessType type, v8::Local<v8::Value> data)
296 { 296 {
297 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 297 v8::Isolate* isolate = v8::Isolate::GetCurrent();
298 Frame* target = findFrame(host, data, isolate); 298 Frame* target = findFrame(isolate, host, data);
299 if (!target) 299 if (!target)
300 return; 300 return;
301 DOMWindow* targetWindow = target->domWindow(); 301 DOMWindow* targetWindow = target->domWindow();
302 302
303 // FIXME: We should modify V8 to pass in more contextual information (contex t, property, and object). 303 // FIXME: We should modify V8 to pass in more contextual information (contex t, property, and object).
304 ExceptionState exceptionState(ExceptionState::UnknownContext, 0, 0, isolate- >GetCurrentContext()->Global(), isolate); 304 ExceptionState exceptionState(ExceptionState::UnknownContext, 0, 0, isolate- >GetCurrentContext()->Global(), isolate);
305 exceptionState.throwSecurityError(targetWindow->sanitizedCrossDomainAccessEr rorMessage(callingDOMWindow(isolate)), targetWindow->crossDomainAccessErrorMessa ge(callingDOMWindow(isolate))); 305 exceptionState.throwSecurityError(targetWindow->sanitizedCrossDomainAccessEr rorMessage(callingDOMWindow(isolate)), targetWindow->crossDomainAccessErrorMessa ge(callingDOMWindow(isolate)));
306 exceptionState.throwIfNeeded(); 306 exceptionState.throwIfNeeded();
307 } 307 }
308 308
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 461
462 v8::V8::AddMessageListener(messageHandlerInWorker); 462 v8::V8::AddMessageListener(messageHandlerInWorker);
463 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); 463 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker);
464 464
465 uint32_t here; 465 uint32_t here;
466 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi ze / sizeof(uint32_t*))); 466 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi ze / sizeof(uint32_t*)));
467 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); 467 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker);
468 } 468 }
469 469
470 } // namespace blink 470 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/NPV8Object.cpp ('k') | Source/bindings/core/v8/V8NPObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698