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

Side by Side Diff: Source/web/WebKit.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/WorkerScriptController.cpp ('k') | 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 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "wtf/Assertions.h" 49 #include "wtf/Assertions.h"
50 #include "wtf/CryptographicallyRandomNumber.h" 50 #include "wtf/CryptographicallyRandomNumber.h"
51 #include "wtf/MainThread.h" 51 #include "wtf/MainThread.h"
52 #include "wtf/UnusedParam.h" 52 #include "wtf/UnusedParam.h"
53 #include "wtf/WTF.h" 53 #include "wtf/WTF.h"
54 #include "wtf/text/AtomicString.h" 54 #include "wtf/text/AtomicString.h"
55 #include "wtf/text/TextEncoding.h" 55 #include "wtf/text/TextEncoding.h"
56 #include "public/platform/Platform.h" 56 #include "public/platform/Platform.h"
57 #include "public/platform/WebPrerenderingSupport.h" 57 #include "public/platform/WebPrerenderingSupport.h"
58 #include "public/platform/WebThread.h" 58 #include "public/platform/WebThread.h"
59 #include <v8-defaults.h>
59 #include <v8.h> 60 #include <v8.h>
60 61
61 namespace WebKit { 62 namespace WebKit {
62 63
63 namespace { 64 namespace {
64 65
65 class EndOfTaskRunner : public WebThread::TaskObserver { 66 class EndOfTaskRunner : public WebThread::TaskObserver {
66 public: 67 public:
67 virtual void willProcessTask() { } 68 virtual void willProcessTask() { }
68 virtual void didProcessTask() 69 virtual void didProcessTask()
(...skipping 25 matching lines...) Expand all
94 ASSERT(!isMainThread() || WebCore::V8RecursionScope::properlyUsed()); 95 ASSERT(!isMainThread() || WebCore::V8RecursionScope::properlyUsed());
95 } 96 }
96 #endif 97 #endif
97 98
98 void initialize(Platform* platform) 99 void initialize(Platform* platform)
99 { 100 {
100 initializeWithoutV8(platform); 101 initializeWithoutV8(platform);
101 102
102 v8::V8::SetEntropySource(&generateEntropy); 103 v8::V8::SetEntropySource(&generateEntropy);
103 v8::V8::SetArrayBufferAllocator(WebCore::v8ArrayBufferAllocator()); 104 v8::V8::SetArrayBufferAllocator(WebCore::v8ArrayBufferAllocator());
105 v8::SetDefaultResourceConstraintsForCurrentPlatform();
104 v8::V8::Initialize(); 106 v8::V8::Initialize();
105 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 107 v8::Isolate* isolate = v8::Isolate::GetCurrent();
106 WebCore::setMainThreadIsolate(isolate); 108 WebCore::setMainThreadIsolate(isolate);
107 WebCore::V8PerIsolateData::ensureInitialized(isolate); 109 WebCore::V8PerIsolateData::ensureInitialized(isolate);
108 110
109 // currentThread will always be non-null in production, but can be null in C hromium unit tests. 111 // currentThread will always be non-null in production, but can be null in C hromium unit tests.
110 if (WebThread* currentThread = platform->currentThread()) { 112 if (WebThread* currentThread = platform->currentThread()) {
111 #ifndef NDEBUG 113 #ifndef NDEBUG
112 v8::V8::AddCallCompletedCallback(&assertV8RecursionScope); 114 v8::V8::AddCallCompletedCallback(&assertV8RecursionScope);
113 #endif 115 #endif
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 UNUSED_PARAM(name); 223 UNUSED_PARAM(name);
222 #endif // !LOG_DISABLED 224 #endif // !LOG_DISABLED
223 } 225 }
224 226
225 void resetPluginCache(bool reloadPages) 227 void resetPluginCache(bool reloadPages)
226 { 228 {
227 WebCore::Page::refreshPlugins(reloadPages); 229 WebCore::Page::refreshPlugins(reloadPages);
228 } 230 }
229 231
230 } // namespace WebKit 232 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/bindings/v8/WorkerScriptController.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698