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

Side by Side Diff: gin/isolate_holder.cc

Issue 172133002: gin: Make it possible to use gin array buffers when running on top of blink (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « gin/array_buffer.cc ('k') | gin/per_isolate_data.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gin/public/isolate_holder.h" 5 #include "gin/public/isolate_holder.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 } // namespace 46 } // namespace
47 47
48 IsolateHolder::IsolateHolder() 48 IsolateHolder::IsolateHolder()
49 : isolate_owner_(true) { 49 : isolate_owner_(true) {
50 EnsureV8Initialized(true); 50 EnsureV8Initialized(true);
51 isolate_ = v8::Isolate::New(); 51 isolate_ = v8::Isolate::New();
52 v8::ResourceConstraints constraints; 52 v8::ResourceConstraints constraints;
53 constraints.ConfigureDefaults(base::SysInfo::AmountOfPhysicalMemory(), 53 constraints.ConfigureDefaults(base::SysInfo::AmountOfPhysicalMemory(),
54 base::SysInfo::NumberOfProcessors()); 54 base::SysInfo::NumberOfProcessors());
55 v8::SetResourceConstraints(isolate_, &constraints); 55 v8::SetResourceConstraints(isolate_, &constraints);
56 Init(); 56 Init(ArrayBufferAllocator::SharedInstance());
57 } 57 }
58 58
59 IsolateHolder::IsolateHolder(v8::Isolate* isolate) 59 IsolateHolder::IsolateHolder(v8::Isolate* isolate)
60 : isolate_owner_(false), 60 : isolate_owner_(false),
61 isolate_(isolate) { 61 isolate_(isolate) {
62 EnsureV8Initialized(false); 62 EnsureV8Initialized(false);
63 Init(); 63 Init(NULL);
64 }
65
66 IsolateHolder::IsolateHolder(v8::Isolate* isolate,
67 v8::ArrayBuffer::Allocator* allocator)
68 : isolate_owner_(false), isolate_(isolate) {
69 EnsureV8Initialized(false);
70 Init(allocator);
64 } 71 }
65 72
66 IsolateHolder::~IsolateHolder() { 73 IsolateHolder::~IsolateHolder() {
67 isolate_data_.reset(); 74 isolate_data_.reset();
68 if (isolate_owner_) 75 if (isolate_owner_)
69 isolate_->Dispose(); 76 isolate_->Dispose();
70 } 77 }
71 78
72 void IsolateHolder::Init() { 79 void IsolateHolder::Init(v8::ArrayBuffer::Allocator* allocator) {
73 v8::Isolate::Scope isolate_scope(isolate_); 80 v8::Isolate::Scope isolate_scope(isolate_);
74 v8::HandleScope handle_scope(isolate_); 81 v8::HandleScope handle_scope(isolate_);
75 isolate_data_.reset(new PerIsolateData(isolate_)); 82 isolate_data_.reset(new PerIsolateData(isolate_, allocator));
76 } 83 }
77 84
78 } // namespace gin 85 } // namespace gin
OLDNEW
« no previous file with comments | « gin/array_buffer.cc ('k') | gin/per_isolate_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698