OLD | NEW |
| (Empty) |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "gin/initialize.h" | |
6 | |
7 #include <stdlib.h> | |
8 #include <string.h> | |
9 | |
10 #include "gin/array_buffer.h" | |
11 #include "gin/per_isolate_data.h" | |
12 | |
13 namespace gin { | |
14 | |
15 namespace { | |
16 | |
17 bool GenerateEntropy(unsigned char* buffer, size_t amount) { | |
18 // TODO(abarth): Gin needs a source of entropy. | |
19 return false; | |
20 } | |
21 | |
22 const char kFlags[] = "--use_strict --harmony"; | |
23 | |
24 } | |
25 | |
26 void Initialize() { | |
27 v8::V8::SetArrayBufferAllocator(ArrayBufferAllocator::SharedInstance()); | |
28 v8::V8::InitializeICU(); | |
29 v8::V8::SetFlagsFromString(kFlags, | |
30 static_cast<uint32_t>(arraysize(kFlags)) - 1); | |
31 v8::V8::SetEntropySource(&GenerateEntropy); | |
32 v8::V8::Initialize(); | |
33 | |
34 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | |
35 v8::HandleScope handle_scope(isolate); | |
36 new PerIsolateData(isolate); | |
37 } | |
38 | |
39 } // namespace gin | |
OLD | NEW |