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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 namespace blink { | 56 namespace blink { |
57 | 57 |
58 static LocalFrame* findFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> da
ta, v8::Isolate* isolate) | 58 static LocalFrame* findFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> da
ta, v8::Isolate* isolate) |
59 { | 59 { |
60 const WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data); | 60 const WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data); |
61 | 61 |
62 if (V8Window::wrapperTypeInfo.equals(type)) { | 62 if (V8Window::wrapperTypeInfo.equals(type)) { |
63 v8::Handle<v8::Object> windowWrapper = V8Window::findInstanceInPrototype
Chain(host, isolate); | 63 v8::Handle<v8::Object> windowWrapper = V8Window::findInstanceInPrototype
Chain(host, isolate); |
64 if (windowWrapper.IsEmpty()) | 64 if (windowWrapper.IsEmpty()) |
65 return 0; | 65 return 0; |
66 return V8Window::toNative(windowWrapper)->frame(); | 66 return V8Window::toImpl(windowWrapper)->frame(); |
67 } | 67 } |
68 | 68 |
69 if (V8History::wrapperTypeInfo.equals(type)) | 69 if (V8History::wrapperTypeInfo.equals(type)) |
70 return V8History::toNative(host)->frame(); | 70 return V8History::toImpl(host)->frame(); |
71 | 71 |
72 if (V8Location::wrapperTypeInfo.equals(type)) | 72 if (V8Location::wrapperTypeInfo.equals(type)) |
73 return V8Location::toNative(host)->frame(); | 73 return V8Location::toImpl(host)->frame(); |
74 | 74 |
75 // This function can handle only those types listed above. | 75 // This function can handle only those types listed above. |
76 ASSERT_NOT_REACHED(); | 76 ASSERT_NOT_REACHED(); |
77 return 0; | 77 return 0; |
78 } | 78 } |
79 | 79 |
80 static void reportFatalErrorInMainThread(const char* location, const char* messa
ge) | 80 static void reportFatalErrorInMainThread(const char* location, const char* messa
ge) |
81 { | 81 { |
82 int memoryUsageMB = blink::Platform::current()->actualMemoryUsageMB(); | 82 int memoryUsageMB = blink::Platform::current()->actualMemoryUsageMB(); |
83 printf("V8 error: %s (%s). Current memory usage: %d MB\n", message, locatio
n, memoryUsageMB); | 83 printf("V8 error: %s (%s). Current memory usage: %d MB\n", message, locatio
n, memoryUsageMB); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 bool shouldUseDocumentURL = resourceName.IsEmpty() || !resourceName->IsStrin
g(); | 120 bool shouldUseDocumentURL = resourceName.IsEmpty() || !resourceName->IsStrin
g(); |
121 String resource = shouldUseDocumentURL ? enteredWindow->document()->url() :
toCoreString(resourceName.As<v8::String>()); | 121 String resource = shouldUseDocumentURL ? enteredWindow->document()->url() :
toCoreString(resourceName.As<v8::String>()); |
122 AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? SharableCr
ossOrigin : NotSharableCrossOrigin; | 122 AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? SharableCr
ossOrigin : NotSharableCrossOrigin; |
123 | 123 |
124 ScriptState* scriptState = ScriptState::current(isolate); | 124 ScriptState* scriptState = ScriptState::current(isolate); |
125 RefPtrWillBeRawPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, reso
urce, message->GetLineNumber(), message->GetStartColumn() + 1, &scriptState->wor
ld()); | 125 RefPtrWillBeRawPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, reso
urce, message->GetLineNumber(), message->GetStartColumn() + 1, &scriptState->wor
ld()); |
126 if (V8DOMWrapper::isDOMWrapper(data)) { | 126 if (V8DOMWrapper::isDOMWrapper(data)) { |
127 v8::Handle<v8::Object> obj = v8::Handle<v8::Object>::Cast(data); | 127 v8::Handle<v8::Object> obj = v8::Handle<v8::Object>::Cast(data); |
128 const WrapperTypeInfo* type = toWrapperTypeInfo(obj); | 128 const WrapperTypeInfo* type = toWrapperTypeInfo(obj); |
129 if (V8DOMException::wrapperTypeInfo.isSubclass(type)) { | 129 if (V8DOMException::wrapperTypeInfo.isSubclass(type)) { |
130 DOMException* exception = V8DOMException::toNative(obj); | 130 DOMException* exception = V8DOMException::toImpl(obj); |
131 if (exception && !exception->messageForConsole().isEmpty()) | 131 if (exception && !exception->messageForConsole().isEmpty()) |
132 event->setUnsanitizedMessage("Uncaught " + exception->toStringFo
rConsole()); | 132 event->setUnsanitizedMessage("Uncaught " + exception->toStringFo
rConsole()); |
133 } | 133 } |
134 } | 134 } |
135 | 135 |
136 // This method might be called while we're creating a new context. In this c
ase, we | 136 // This method might be called while we're creating a new context. In this c
ase, we |
137 // avoid storing the exception object, as we can't create a wrapper during c
ontext creation. | 137 // avoid storing the exception object, as we can't create a wrapper during c
ontext creation. |
138 // FIXME: Can we even get here during initialization now that we bail out wh
en GetEntered returns an empty handle? | 138 // FIXME: Can we even get here during initialization now that we bail out wh
en GetEntered returns an empty handle? |
139 LocalFrame* frame = enteredWindow->document()->frame(); | 139 LocalFrame* frame = enteredWindow->document()->frame(); |
140 if (frame && frame->script().existingWindowProxy(scriptState->world())) { | 140 if (frame && frame->script().existingWindowProxy(scriptState->world())) { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 v8::V8::AddMessageListener(messageHandlerInWorker); | 269 v8::V8::AddMessageListener(messageHandlerInWorker); |
270 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); | 270 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); |
271 | 271 |
272 v8::ResourceConstraints resourceConstraints; | 272 v8::ResourceConstraints resourceConstraints; |
273 uint32_t here; | 273 uint32_t here; |
274 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin
t32_t*)); | 274 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin
t32_t*)); |
275 v8::SetResourceConstraints(isolate, &resourceConstraints); | 275 v8::SetResourceConstraints(isolate, &resourceConstraints); |
276 } | 276 } |
277 | 277 |
278 } // namespace blink | 278 } // namespace blink |
OLD | NEW |