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

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

Issue 24550008: Configure V8 ResourceConstraints based on a device capabilities. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 7 years, 2 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 | « no previous file | no next file » | 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/page/ContentSecurityPolicy.h" 47 #include "core/page/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>
54 55
55 namespace WebCore { 56 namespace WebCore {
56 57
57 static Frame* findFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> data, v 8::Isolate* isolate) 58 static Frame* findFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> data, v 8::Isolate* isolate)
58 { 59 {
59 WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data); 60 WrapperTypeInfo* type = WrapperTypeInfo::unwrap(data);
60 61
61 if (V8Window::info.equals(type)) { 62 if (V8Window::info.equals(type)) {
62 v8::Handle<v8::Object> windowWrapper = host->FindInstanceInPrototypeChai n(V8Window::GetTemplate(isolate, worldTypeInMainThread(isolate))); 63 v8::Handle<v8::Object> windowWrapper = host->FindInstanceInPrototypeChai n(V8Window::GetTemplate(isolate, worldTypeInMainThread(isolate)));
63 if (windowWrapper.IsEmpty()) 64 if (windowWrapper.IsEmpty())
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 if (initialized) 167 if (initialized)
167 return; 168 return;
168 initialized = true; 169 initialized = true;
169 170
170 initializeV8Common(); 171 initializeV8Common();
171 172
172 v8::V8::SetFatalErrorHandler(reportFatalErrorInMainThread); 173 v8::V8::SetFatalErrorHandler(reportFatalErrorInMainThread);
173 v8::V8::AddMessageListener(messageHandlerInMainThread); 174 v8::V8::AddMessageListener(messageHandlerInMainThread);
174 v8::V8::SetFailedAccessCheckCallbackFunction(failedAccessCheckCallbackInMain Thread); 175 v8::V8::SetFailedAccessCheckCallbackFunction(failedAccessCheckCallbackInMain Thread);
175 v8::V8::SetAllowCodeGenerationFromStringsCallback(codeGenerationCheckCallbac kInMainThread); 176 v8::V8::SetAllowCodeGenerationFromStringsCallback(codeGenerationCheckCallbac kInMainThread);
177 v8::SetDefaultResourceConstraintsForCurrentPlatform();
176 ScriptProfiler::initialize(); 178 ScriptProfiler::initialize();
177 V8PerIsolateData::ensureInitialized(isolate); 179 V8PerIsolateData::ensureInitialized(isolate);
178 } 180 }
179 181
180 static void reportFatalErrorInWorker(const char* location, const char* message) 182 static void reportFatalErrorInWorker(const char* location, const char* message)
181 { 183 {
182 // FIXME: We temporarily deal with V8 internal error situations such as out- of-memory by crashing the worker. 184 // FIXME: We temporarily deal with V8 internal error situations such as out- of-memory by crashing the worker.
183 CRASH(); 185 CRASH();
184 } 186 }
185 187
(...skipping 23 matching lines...) Expand all
209 static const int kWorkerMaxStackSize = 500 * 1024; 211 static const int kWorkerMaxStackSize = 500 * 1024;
210 212
211 void V8Initializer::initializeWorker(v8::Isolate* isolate) 213 void V8Initializer::initializeWorker(v8::Isolate* isolate)
212 { 214 {
213 initializeV8Common(); 215 initializeV8Common();
214 216
215 v8::V8::AddMessageListener(messageHandlerInWorker); 217 v8::V8::AddMessageListener(messageHandlerInWorker);
216 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); 218 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker);
217 219
218 v8::ResourceConstraints resourceConstraints; 220 v8::ResourceConstraints resourceConstraints;
221 v8::ConfigureResourceConstraintsForCurrentPlatform(&resourceConstraints);
219 uint32_t here; 222 uint32_t here;
220 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin t32_t*)); 223 resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uin t32_t*));
221 v8::SetResourceConstraints(&resourceConstraints); 224 v8::SetResourceConstraints(&resourceConstraints);
222 225
223 V8PerIsolateData::ensureInitialized(isolate); 226 V8PerIsolateData::ensureInitialized(isolate);
224 } 227 }
225 228
226 } // namespace WebCore 229 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698