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

Side by Side Diff: gin/per_isolate_data.cc

Issue 62333018: Implement Asynchronous Module Definition API for Mojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Aaron's comments Created 7 years, 1 month 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/per_isolate_data.h ('k') | gin/runner.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/per_isolate_data.h" 5 #include "gin/per_isolate_data.h"
6 6
7 using v8::Eternal; 7 using v8::Eternal;
8 using v8::Handle; 8 using v8::Handle;
9 using v8::Isolate; 9 using v8::Isolate;
10 using v8::Local; 10 using v8::Local;
11 using v8::Object; 11 using v8::Object;
12 using v8::FunctionTemplate;
12 using v8::ObjectTemplate; 13 using v8::ObjectTemplate;
13 14
14 namespace gin { 15 namespace gin {
15 16
16 PerIsolateData::PerIsolateData(Isolate* isolate) 17 PerIsolateData::PerIsolateData(Isolate* isolate)
17 : isolate_(isolate) { 18 : isolate_(isolate) {
18 isolate_->SetData(this); 19 isolate_->SetData(this);
19 } 20 }
20 21
21 PerIsolateData::~PerIsolateData() { 22 PerIsolateData::~PerIsolateData() {
22 } 23 }
23 24
24 PerIsolateData* PerIsolateData::From(Isolate* isolate) { 25 PerIsolateData* PerIsolateData::From(Isolate* isolate) {
25 return static_cast<PerIsolateData*>(isolate->GetData()); 26 return static_cast<PerIsolateData*>(isolate->GetData());
26 } 27 }
27 28
28 void PerIsolateData::SetObjectTemplate(WrapperInfo* info, 29 void PerIsolateData::SetObjectTemplate(WrapperInfo* info,
29 Local<ObjectTemplate> templ) { 30 Local<ObjectTemplate> templ) {
30 object_templates_[info] = Eternal<ObjectTemplate>(isolate_, templ); 31 object_templates_[info] = Eternal<ObjectTemplate>(isolate_, templ);
31 } 32 }
32 33
34 void PerIsolateData::SetFunctionTemplate(WrapperInfo* info,
35 Local<FunctionTemplate> templ) {
36 function_templates_[info] = Eternal<FunctionTemplate>(isolate_, templ);
37 }
38
33 v8::Local<v8::ObjectTemplate> PerIsolateData::GetObjectTemplate( 39 v8::Local<v8::ObjectTemplate> PerIsolateData::GetObjectTemplate(
34 WrapperInfo* info) { 40 WrapperInfo* info) {
35 ObjectTemplateMap::iterator it = object_templates_.find(info); 41 ObjectTemplateMap::iterator it = object_templates_.find(info);
36 if (it == object_templates_.end()) 42 if (it == object_templates_.end())
37 return v8::Local<v8::ObjectTemplate>(); 43 return v8::Local<v8::ObjectTemplate>();
38 return it->second.Get(isolate_); 44 return it->second.Get(isolate_);
39 } 45 }
40 46
47 v8::Local<v8::FunctionTemplate> PerIsolateData::GetFunctionTemplate(
48 WrapperInfo* info) {
49 FunctionTemplateMap::iterator it = function_templates_.find(info);
50 if (it == function_templates_.end())
51 return v8::Local<v8::FunctionTemplate>();
52 return it->second.Get(isolate_);
53 }
54
41 } // namespace gin 55 } // namespace gin
OLDNEW
« no previous file with comments | « gin/per_isolate_data.h ('k') | gin/runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698