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

Side by Side Diff: bindings/v8/V8DOMWrapper.h

Issue 355047: Faster access to isolated worlds. (Closed) Base URL: http://svn.webkit.org/repository/webkit/trunk/WebCore/
Patch Set: '' Created 11 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
« no previous file with comments | « no previous file | bindings/v8/V8DOMWrapper.cpp » ('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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 }; 102 };
103 103
104 class V8DOMWrapper { 104 class V8DOMWrapper {
105 public: 105 public:
106 #ifndef NDEBUG 106 #ifndef NDEBUG
107 // Checks if a v8 value can be a DOM wrapper 107 // Checks if a v8 value can be a DOM wrapper
108 static bool maybeDOMWrapper(v8::Handle<v8::Value>); 108 static bool maybeDOMWrapper(v8::Handle<v8::Value>);
109 #endif 109 #endif
110 110
111 // Sets contents of a DOM wrapper. 111 // Sets contents of a DOM wrapper.
112 static void setDOMWrapper(v8::Handle<v8::Object>, int type, void* ptr); 112 static void setDOMWrapper(v8::Handle<v8::Object> object, int type, void* cptr)
113 {
114 ASSERT(object->InternalFieldCount() >= 2);
115 object->SetPointerInInternalField(V8Custom::kDOMWrapperObjectIndex, cptr);
116 object->SetInternalField(V8Custom::kDOMWrapperTypeIndex, v8::Integer ::New(type));
117 }
113 118
114 static v8::Handle<v8::Object> lookupDOMWrapper(V8ClassIndex::V8WrapperTy pe type, v8::Handle<v8::Object> object) 119 static v8::Handle<v8::Object> lookupDOMWrapper(V8ClassIndex::V8WrapperTy pe type, v8::Handle<v8::Object> object)
115 { 120 {
116 return object.IsEmpty() ? object : object->FindInstanceInPrototypeCh ain(getTemplate(type)); 121 return object.IsEmpty() ? object : object->FindInstanceInPrototypeCh ain(getTemplate(type));
117 } 122 }
118 123
119 // A helper function extract native object pointer from a DOM wrapper 124 // A helper function extract native object pointer from a DOM wrapper
120 // and cast to the specified type. 125 // and cast to the specified type.
121 template <class C> 126 template <class C>
122 static C* convertDOMWrapperToNative(v8::Handle<v8::Object> object) 127 static C* convertDOMWrapperToNative(v8::Handle<v8::Object> object)
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 { 324 {
320 return instantiateV8Object(NULL, descType, cptrType, impl); 325 return instantiateV8Object(NULL, descType, cptrType, impl);
321 } 326 }
322 327
323 static v8::Local<v8::Object> instantiateV8Object(V8Proxy*, V8ClassIndex: :V8WrapperType, V8ClassIndex::V8WrapperType, void*); 328 static v8::Local<v8::Object> instantiateV8Object(V8Proxy*, V8ClassIndex: :V8WrapperType, V8ClassIndex::V8WrapperType, void*);
324 }; 329 };
325 330
326 } 331 }
327 332
328 #endif // V8DOMWrapper_h 333 #endif // V8DOMWrapper_h
OLDNEW
« no previous file with comments | « no previous file | bindings/v8/V8DOMWrapper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698