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

Side by Side Diff: Source/bindings/core/v8/ScriptWrappable.h

Issue 542113003: bindings: Introduces ScriptWrappable::associateWithWrapper in addition to wrap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 149 }
150 150
151 // Returns the WrapperTypeInfo of the instance. 151 // Returns the WrapperTypeInfo of the instance.
152 // 152 //
153 // This method must be overridden by DEFINE_WRAPPERTYPEINFO macro. 153 // This method must be overridden by DEFINE_WRAPPERTYPEINFO macro.
154 virtual const WrapperTypeInfo* wrapperTypeInfo() const = 0; 154 virtual const WrapperTypeInfo* wrapperTypeInfo() const = 0;
155 155
156 // Creates and returns a new wrapper object. 156 // Creates and returns a new wrapper object.
157 virtual v8::Handle<v8::Object> wrap(v8::Handle<v8::Object> creationContext, v8::Isolate*); 157 virtual v8::Handle<v8::Object> wrap(v8::Handle<v8::Object> creationContext, v8::Isolate*);
158 158
159 // Associates the instance with the existing wrapper. Returns |wrapper|.
160 v8::Handle<v8::Object> associateWithWrapper(const WrapperTypeInfo*, v8::Hand le<v8::Object> wrapper, v8::Isolate*);
161
159 void setWrapper(v8::Handle<v8::Object> wrapper, v8::Isolate* isolate, const WrapperTypeInfo* wrapperTypeInfo) 162 void setWrapper(v8::Handle<v8::Object> wrapper, v8::Isolate* isolate, const WrapperTypeInfo* wrapperTypeInfo)
160 { 163 {
161 ASSERT(!containsWrapper()); 164 ASSERT(!containsWrapper());
162 if (!*wrapper) { 165 if (!*wrapper) {
163 m_wrapperOrTypeInfo = 0; 166 m_wrapperOrTypeInfo = 0;
164 return; 167 return;
165 } 168 }
166 v8::Persistent<v8::Object> persistent(isolate, wrapper); 169 v8::Persistent<v8::Object> persistent(isolate, wrapper);
167 wrapperTypeInfo->configureWrapper(&persistent); 170 wrapperTypeInfo->configureWrapper(&persistent);
168 persistent.SetWeak(this, &setWeakCallback); 171 persistent.SetWeak(this, &setWeakCallback);
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 virtual const WrapperTypeInfo* wrapperTypeInfo() const OVERRIDE \ 369 virtual const WrapperTypeInfo* wrapperTypeInfo() const OVERRIDE \
367 { \ 370 { \
368 return &s_wrapperTypeInfo; \ 371 return &s_wrapperTypeInfo; \
369 } \ 372 } \
370 private: \ 373 private: \
371 static const WrapperTypeInfo& s_wrapperTypeInfo 374 static const WrapperTypeInfo& s_wrapperTypeInfo
372 375
373 } // namespace blink 376 } // namespace blink
374 377
375 #endif // ScriptWrappable_h 378 #endif // ScriptWrappable_h
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/core/v8/ScriptWrappable.cpp » ('j') | Source/core/dom/Document.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698