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

Side by Side Diff: sky/engine/bindings/core/v8/ScriptValue.h

Issue 872043003: module.exports should default to an empty object. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 ASSERT(isEmpty() || m_scriptState); 53 ASSERT(isEmpty() || m_scriptState);
54 } 54 }
55 55
56 ScriptValue(const ScriptValue& value) 56 ScriptValue(const ScriptValue& value)
57 : m_scriptState(value.m_scriptState) 57 : m_scriptState(value.m_scriptState)
58 , m_value(value.m_value) 58 , m_value(value.m_value)
59 { 59 {
60 ASSERT(isEmpty() || m_scriptState); 60 ASSERT(isEmpty() || m_scriptState);
61 } 61 }
62 62
63 static ScriptValue createEmptyObject(ScriptState* scriptState)
64 {
65 return ScriptValue(scriptState, v8::Object::New(scriptState->isolate())) ;
66 }
67
63 ScriptState* scriptState() const 68 ScriptState* scriptState() const
64 { 69 {
65 return m_scriptState.get(); 70 return m_scriptState.get();
66 } 71 }
67 72
68 v8::Isolate* isolate() const 73 v8::Isolate* isolate() const
69 { 74 {
70 return m_scriptState ? m_scriptState->isolate() : v8::Isolate::GetCurren t(); 75 return m_scriptState ? m_scriptState->isolate() : v8::Isolate::GetCurren t();
71 } 76 }
72 77
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 PassRefPtr<JSONValue> toJSONValue(ScriptState*) const; 147 PassRefPtr<JSONValue> toJSONValue(ScriptState*) const;
143 148
144 private: 149 private:
145 RefPtr<ScriptState> m_scriptState; 150 RefPtr<ScriptState> m_scriptState;
146 RefPtr<SharedPersistent<v8::Value> > m_value; 151 RefPtr<SharedPersistent<v8::Value> > m_value;
147 }; 152 };
148 153
149 } // namespace blink 154 } // namespace blink
150 155
151 #endif // SKY_ENGINE_BINDINGS_CORE_V8_SCRIPTVALUE_H_ 156 #endif // SKY_ENGINE_BINDINGS_CORE_V8_SCRIPTVALUE_H_
OLDNEW
« no previous file with comments | « sky/engine/bindings/core/v8/ScriptController.cpp ('k') | sky/engine/bindings/templates/attributes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698