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

Unified Diff: gin/isolate_holder.cc

Issue 227233006: Make net use v8 through gin (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/net/proxy_service_factory.cc ('k') | gin/public/isolate_holder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gin/isolate_holder.cc
diff --git a/gin/isolate_holder.cc b/gin/isolate_holder.cc
index 3bda7f5738da93c7bf03c159cb941a342e77ac31..805ab27482395b6e6b3f63368b03ed6dc1f6139b 100644
--- a/gin/isolate_holder.cc
+++ b/gin/isolate_holder.cc
@@ -24,8 +24,8 @@ bool GenerateEntropy(unsigned char* buffer, size_t amount) {
return true;
}
-
-void EnsureV8Initialized(bool gin_managed) {
+void EnsureV8Initialized(gin::IsolateHolder::ScriptMode mode,
+ bool gin_managed) {
static bool v8_is_initialized = false;
static bool v8_is_gin_managed = false;
if (v8_is_initialized) {
@@ -39,17 +39,20 @@ void EnsureV8Initialized(bool gin_managed) {
v8::V8::InitializePlatform(V8Platform::Get());
v8::V8::SetArrayBufferAllocator(ArrayBufferAllocator::SharedInstance());
- static const char v8_flags[] = "--use_strict --harmony";
- v8::V8::SetFlagsFromString(v8_flags, sizeof(v8_flags) - 1);
+ if (mode == gin::IsolateHolder::kStrictMode) {
+ // TODO(jochen): drop --harmony. it's really too unstable and broad to use.
+ static const char v8_flags[] = "--use_strict --harmony";
+ v8::V8::SetFlagsFromString(v8_flags, sizeof(v8_flags) - 1);
+ }
v8::V8::SetEntropySource(&GenerateEntropy);
v8::V8::Initialize();
}
} // namespace
-IsolateHolder::IsolateHolder()
+IsolateHolder::IsolateHolder(ScriptMode mode)
: isolate_owner_(true) {
- EnsureV8Initialized(true);
+ EnsureV8Initialized(mode, true);
isolate_ = v8::Isolate::New();
v8::ResourceConstraints constraints;
constraints.ConfigureDefaults(base::SysInfo::AmountOfPhysicalMemory(),
@@ -61,7 +64,7 @@ IsolateHolder::IsolateHolder()
IsolateHolder::IsolateHolder(v8::Isolate* isolate,
v8::ArrayBuffer::Allocator* allocator)
: isolate_owner_(false), isolate_(isolate) {
- EnsureV8Initialized(false);
+ EnsureV8Initialized(kNonStrictMode, false);
Init(allocator);
}
« no previous file with comments | « chrome/browser/net/proxy_service_factory.cc ('k') | gin/public/isolate_holder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698