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

Side by Side Diff: Source/bindings/v8/V8PerContextData.cpp

Issue 345893002: Implement an infrastructure of Blink-in-JS Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | « Source/bindings/v8/V8PerContextData.h ('k') | Source/bindings/v8/V8PerIsolateData.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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 23 matching lines...) Expand all
34 #include "bindings/v8/ScriptState.h" 34 #include "bindings/v8/ScriptState.h"
35 #include "bindings/v8/V8Binding.h" 35 #include "bindings/v8/V8Binding.h"
36 #include "bindings/v8/V8ObjectConstructor.h" 36 #include "bindings/v8/V8ObjectConstructor.h"
37 #include "wtf/StringExtras.h" 37 #include "wtf/StringExtras.h"
38 38
39 #include <stdlib.h> 39 #include <stdlib.h>
40 40
41 namespace WebCore { 41 namespace WebCore {
42 42
43 V8PerContextData::V8PerContextData(v8::Handle<v8::Context> context) 43 V8PerContextData::V8PerContextData(v8::Handle<v8::Context> context)
44 : m_wrapperBoilerplates(context->GetIsolate()) 44 : m_isolate(context->GetIsolate())
45 , m_constructorMap(context->GetIsolate()) 45 , m_wrapperBoilerplates(m_isolate)
46 , m_isolate(context->GetIsolate()) 46 , m_constructorMap(m_isolate)
47 , m_contextHolder(adoptPtr(new gin::ContextHolder(context->GetIsolate()))) 47 , m_contextHolder(adoptPtr(new gin::ContextHolder(m_isolate)))
48 , m_context(m_isolate, context) 48 , m_context(m_isolate, context)
49 , m_customElementBindings(adoptPtr(new CustomElementBindingMap())) 49 , m_customElementBindings(adoptPtr(new CustomElementBindingMap()))
50 , m_activityLogger(0) 50 , m_activityLogger(0)
51 , m_compiledPrivateScript(m_isolate)
51 { 52 {
52 m_contextHolder->SetContext(context); 53 m_contextHolder->SetContext(context);
53 54
54 v8::Context::Scope contextScope(context); 55 v8::Context::Scope contextScope(context);
55 ASSERT(m_errorPrototype.isEmpty()); 56 ASSERT(m_errorPrototype.isEmpty());
56 v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(context->Global ()->Get(v8AtomicString(m_isolate, "Error"))); 57 v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(context->Global ()->Get(v8AtomicString(m_isolate, "Error")));
57 ASSERT(!object.IsEmpty()); 58 ASSERT(!object.IsEmpty());
58 v8::Handle<v8::Value> prototypeValue = object->Get(v8AtomicString(m_isolate, "prototype")); 59 v8::Handle<v8::Value> prototypeValue = object->Get(v8AtomicString(m_isolate, "prototype"));
59 ASSERT(!prototypeValue.IsEmpty()); 60 ASSERT(!prototypeValue.IsEmpty());
60 m_errorPrototype.set(m_isolate, prototypeValue); 61 m_errorPrototype.set(m_isolate, prototypeValue);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 197
197 if (!data->IsString()) 198 if (!data->IsString())
198 return -1; 199 return -1;
199 v8::String::Utf8Value utf8(data); 200 v8::String::Utf8Value utf8(data);
200 char* comma = strnstr(*utf8, ",", utf8.length()); 201 char* comma = strnstr(*utf8, ",", utf8.length());
201 if (!comma) 202 if (!comma)
202 return -1; 203 return -1;
203 return atoi(comma + 1); 204 return atoi(comma + 1);
204 } 205 }
205 206
207 v8::Handle<v8::Value> V8PerContextData::compiledPrivateScript(String className)
208 {
209 return m_compiledPrivateScript.Get(className);
210 }
211
212 void V8PerContextData::setCompiledPrivateScript(String className, v8::Handle<v8: :Value> compiledObject)
213 {
214 m_compiledPrivateScript.Set(className, compiledObject);
215 }
216
206 } // namespace WebCore 217 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8PerContextData.h ('k') | Source/bindings/v8/V8PerIsolateData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698