| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #include "core/dom/ExceptionCode.h" | 44 #include "core/dom/ExceptionCode.h" |
| 45 #include "core/inspector/ScriptCallStack.h" | 45 #include "core/inspector/ScriptCallStack.h" |
| 46 #include "core/frame/ConsoleTypes.h" | 46 #include "core/frame/ConsoleTypes.h" |
| 47 #include "core/frame/ContentSecurityPolicy.h" | 47 #include "core/frame/ContentSecurityPolicy.h" |
| 48 #include "core/frame/DOMWindow.h" | 48 #include "core/frame/DOMWindow.h" |
| 49 #include "core/frame/Frame.h" | 49 #include "core/frame/Frame.h" |
| 50 #include "core/platform/MemoryUsageSupport.h" | 50 #include "core/platform/MemoryUsageSupport.h" |
| 51 #include "wtf/RefPtr.h" | 51 #include "wtf/RefPtr.h" |
| 52 #include "wtf/text/WTFString.h" | 52 #include "wtf/text/WTFString.h" |
| 53 #include <v8-debug.h> | 53 #include <v8-debug.h> |
| 54 #include <v8-defaults.h> | |
| 55 | 54 |
| 56 namespace WebCore { | 55 namespace WebCore { |
| 57 | 56 |
| 58 static Frame* findFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> data, v
8::Isolate* isolate) | 57 static Frame* findFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> data, v
8::Isolate* isolate) |
| 59 { | 58 { |
| 60 WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data); | 59 WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data); |
| 61 | 60 |
| 62 if (V8Window::info.equals(type)) { | 61 if (V8Window::info.equals(type)) { |
| 63 v8::Handle<v8::Object> windowWrapper = host->FindInstanceInPrototypeChai
n(V8Window::GetTemplate(isolate, worldTypeInMainThread(isolate))); | 62 v8::Handle<v8::Object> windowWrapper = host->FindInstanceInPrototypeChai
n(V8Window::GetTemplate(isolate, worldTypeInMainThread(isolate))); |
| 64 if (windowWrapper.IsEmpty()) | 63 if (windowWrapper.IsEmpty()) |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 if (initialized) | 166 if (initialized) |
| 168 return; | 167 return; |
| 169 initialized = true; | 168 initialized = true; |
| 170 | 169 |
| 171 initializeV8Common(); | 170 initializeV8Common(); |
| 172 | 171 |
| 173 v8::V8::SetFatalErrorHandler(reportFatalErrorInMainThread); | 172 v8::V8::SetFatalErrorHandler(reportFatalErrorInMainThread); |
| 174 v8::V8::AddMessageListener(messageHandlerInMainThread); | 173 v8::V8::AddMessageListener(messageHandlerInMainThread); |
| 175 v8::V8::SetFailedAccessCheckCallbackFunction(failedAccessCheckCallbackInMain
Thread); | 174 v8::V8::SetFailedAccessCheckCallbackFunction(failedAccessCheckCallbackInMain
Thread); |
| 176 v8::V8::SetAllowCodeGenerationFromStringsCallback(codeGenerationCheckCallbac
kInMainThread); | 175 v8::V8::SetAllowCodeGenerationFromStringsCallback(codeGenerationCheckCallbac
kInMainThread); |
| 177 v8::SetDefaultResourceConstraintsForCurrentPlatform(); | |
| 178 ScriptProfiler::initialize(); | 176 ScriptProfiler::initialize(); |
| 179 V8PerIsolateData::ensureInitialized(isolate); | 177 V8PerIsolateData::ensureInitialized(isolate); |
| 180 } | 178 } |
| 181 | 179 |
| 182 static void reportFatalErrorInWorker(const char* location, const char* message) | 180 static void reportFatalErrorInWorker(const char* location, const char* message) |
| 183 { | 181 { |
| 184 // FIXME: We temporarily deal with V8 internal error situations such as out-
of-memory by crashing the worker. | 182 // FIXME: We temporarily deal with V8 internal error situations such as out-
of-memory by crashing the worker. |
| 185 CRASH(); | 183 CRASH(); |
| 186 } | 184 } |
| 187 | 185 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 211 static const int kWorkerMaxStackSize = 500 * 1024; | 209 static const int kWorkerMaxStackSize = 500 * 1024; |
| 212 | 210 |
| 213 void V8Initializer::initializeWorker(v8::Isolate* isolate) | 211 void V8Initializer::initializeWorker(v8::Isolate* isolate) |
| 214 { | 212 { |
| 215 initializeV8Common(); | 213 initializeV8Common(); |
| 216 | 214 |
| 217 v8::V8::AddMessageListener(messageHandlerInWorker); | 215 v8::V8::AddMessageListener(messageHandlerInWorker); |
| 218 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); | 216 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); |
| 219 | 217 |
| 220 v8::ResourceConstraints resourceConstraints; | 218 v8::ResourceConstraints resourceConstraints; |
| 221 v8::ConfigureResourceConstraintsForCurrentPlatform(&resourceConstraints); | |
| 222 uint32_t here; | 219 uint32_t here; |
| 223 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin
t32_t*)); | 220 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin
t32_t*)); |
| 224 v8::SetResourceConstraints(&resourceConstraints); | 221 v8::SetResourceConstraints(&resourceConstraints); |
| 225 | 222 |
| 226 V8PerIsolateData::ensureInitialized(isolate); | 223 V8PerIsolateData::ensureInitialized(isolate); |
| 227 } | 224 } |
| 228 | 225 |
| 229 } // namespace WebCore | 226 } // namespace WebCore |
| OLD | NEW |