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

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

Issue 26868004: Set default resource constraints on V8 before the the default isolate is initialized (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix workers too. 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 | « Source/bindings/v8/V8Initializer.cpp ('k') | Source/web/WebKit.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, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2012 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 30 matching lines...) Expand all
41 #include "bindings/v8/V8GCController.h" 41 #include "bindings/v8/V8GCController.h"
42 #include "bindings/v8/V8Initializer.h" 42 #include "bindings/v8/V8Initializer.h"
43 #include "bindings/v8/V8ObjectConstructor.h" 43 #include "bindings/v8/V8ObjectConstructor.h"
44 #include "bindings/v8/V8ScriptRunner.h" 44 #include "bindings/v8/V8ScriptRunner.h"
45 #include "bindings/v8/WrapperTypeInfo.h" 45 #include "bindings/v8/WrapperTypeInfo.h"
46 #include "core/inspector/ScriptCallStack.h" 46 #include "core/inspector/ScriptCallStack.h"
47 #include "core/frame/DOMTimer.h" 47 #include "core/frame/DOMTimer.h"
48 #include "core/workers/WorkerGlobalScope.h" 48 #include "core/workers/WorkerGlobalScope.h"
49 #include "core/workers/WorkerObjectProxy.h" 49 #include "core/workers/WorkerObjectProxy.h"
50 #include "core/workers/WorkerThread.h" 50 #include "core/workers/WorkerThread.h"
51 #include <v8-defaults.h>
51 #include <v8.h> 52 #include <v8.h>
52 53
53 #include "public/platform/Platform.h" 54 #include "public/platform/Platform.h"
54 #include "public/platform/WebWorkerRunLoop.h" 55 #include "public/platform/WebWorkerRunLoop.h"
55 56
56 namespace WebCore { 57 namespace WebCore {
57 58
58 WorkerScriptController::WorkerScriptController(WorkerGlobalScope* workerGlobalSc ope) 59 WorkerScriptController::WorkerScriptController(WorkerGlobalScope* workerGlobalSc ope)
59 : m_workerGlobalScope(workerGlobalScope) 60 : m_workerGlobalScope(workerGlobalScope)
60 , m_isolate(v8::Isolate::New()) 61 , m_isolate(v8::Isolate::New())
61 , m_executionForbidden(false) 62 , m_executionForbidden(false)
62 , m_executionScheduledToTerminate(false) 63 , m_executionScheduledToTerminate(false)
63 { 64 {
64 m_isolate->Enter(); 65 m_isolate->Enter();
66 v8::SetDefaultResourceConstraintsForCurrentPlatform();
65 v8::V8::Initialize(); 67 v8::V8::Initialize();
66 V8PerIsolateData* data = V8PerIsolateData::create(m_isolate); 68 V8PerIsolateData* data = V8PerIsolateData::create(m_isolate);
67 m_domDataStore = adoptPtr(new DOMDataStore(WorkerWorld)); 69 m_domDataStore = adoptPtr(new DOMDataStore(WorkerWorld));
68 data->setWorkerDOMDataStore(m_domDataStore.get()); 70 data->setWorkerDOMDataStore(m_domDataStore.get());
69 71
70 V8Initializer::initializeWorker(m_isolate); 72 V8Initializer::initializeWorker(m_isolate);
71 } 73 }
72 74
73 WorkerScriptController::~WorkerScriptController() 75 WorkerScriptController::~WorkerScriptController()
74 { 76 {
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 v8::Handle<v8::Object> global = context->Global(); 252 v8::Handle<v8::Object> global = context->Global();
251 global = global->FindInstanceInPrototypeChain(V8WorkerGlobalScope::GetTempla te(context->GetIsolate(), WorkerWorld)); 253 global = global->FindInstanceInPrototypeChain(V8WorkerGlobalScope::GetTempla te(context->GetIsolate(), WorkerWorld));
252 // Return 0 if the current executing context is not the worker context. 254 // Return 0 if the current executing context is not the worker context.
253 if (global.IsEmpty()) 255 if (global.IsEmpty())
254 return 0; 256 return 0;
255 WorkerGlobalScope* workerGlobalScope = V8WorkerGlobalScope::toNative(global) ; 257 WorkerGlobalScope* workerGlobalScope = V8WorkerGlobalScope::toNative(global) ;
256 return workerGlobalScope->script(); 258 return workerGlobalScope->script();
257 } 259 }
258 260
259 } // namespace WebCore 261 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8Initializer.cpp ('k') | Source/web/WebKit.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698