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

Side by Side Diff: Source/bindings/core/v8/NPV8Object.cpp

Issue 537403002: bindings: Renames from/toInternalPointer, etc. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Synced. 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
« no previous file with comments | « Source/bindings/core/v8/NPV8Object.h ('k') | Source/bindings/core/v8/ScriptDebugServer.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) 2004, 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
3 * Copyright (C) 2007, 2008, 2009 Google, Inc. All rights reserved. 3 * Copyright (C) 2007, 2008, 2009 Google, Inc. All rights reserved.
4 * Copyright (C) 2014 Opera Software ASA. All rights reserved. 4 * Copyright (C) 2014 Opera Software ASA. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 if (identifier->isString) 115 if (identifier->isString)
116 return v8AtomicString(isolate, static_cast<const char*>(identifier->valu e.string)); 116 return v8AtomicString(isolate, static_cast<const char*>(identifier->valu e.string));
117 117
118 char buffer[32]; 118 char buffer[32];
119 snprintf(buffer, sizeof(buffer), "%d", identifier->value.number); 119 snprintf(buffer, sizeof(buffer), "%d", identifier->value.number);
120 return v8AtomicString(isolate, buffer); 120 return v8AtomicString(isolate, buffer);
121 } 121 }
122 122
123 NPObject* v8ObjectToNPObject(v8::Handle<v8::Object> object) 123 NPObject* v8ObjectToNPObject(v8::Handle<v8::Object> object)
124 { 124 {
125 return reinterpret_cast<NPObject*>(toInternalPointer(object)); 125 return reinterpret_cast<NPObject*>(toScriptWrappableBase(object));
126 } 126 }
127 127
128 bool isWrappedNPObject(v8::Handle<v8::Object> object) 128 bool isWrappedNPObject(v8::Handle<v8::Object> object)
129 { 129 {
130 if (object->InternalFieldCount() == npObjectInternalFieldCount) { 130 if (object->InternalFieldCount() == npObjectInternalFieldCount) {
131 const WrapperTypeInfo* typeInfo = static_cast<const WrapperTypeInfo*>(ob ject->GetAlignedPointerFromInternalField(v8DOMWrapperTypeIndex)); 131 const WrapperTypeInfo* typeInfo = static_cast<const WrapperTypeInfo*>(ob ject->GetAlignedPointerFromInternalField(v8DOMWrapperTypeIndex));
132 return typeInfo == npObjectTypeInfo(); 132 return typeInfo == npObjectTypeInfo();
133 } 133 }
134 return false; 134 return false;
135 } 135 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 V8NPObject* npObjectToV8NPObject(NPObject* npObject) 180 V8NPObject* npObjectToV8NPObject(NPObject* npObject)
181 { 181 {
182 if (npObject->_class != &V8NPObjectClass) 182 if (npObject->_class != &V8NPObjectClass)
183 return 0; 183 return 0;
184 V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject); 184 V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject);
185 if (v8NpObject->v8Object.IsEmpty()) 185 if (v8NpObject->v8Object.IsEmpty())
186 return 0; 186 return 0;
187 return v8NpObject; 187 return v8NpObject;
188 } 188 }
189 189
190 ScriptWrappableBase* npObjectToInternalPointer(NPObject* npObject) 190 ScriptWrappableBase* npObjectToScriptWrappableBase(NPObject* npObject)
191 { 191 {
192 return reinterpret_cast<ScriptWrappableBase*>(npObject); 192 return reinterpret_cast<ScriptWrappableBase*>(npObject);
193 } 193 }
194 194
195 void disposeUnderlyingV8Object(NPObject* npObject, v8::Isolate* isolate) 195 void disposeUnderlyingV8Object(NPObject* npObject, v8::Isolate* isolate)
196 { 196 {
197 ASSERT(npObject); 197 ASSERT(npObject);
198 V8NPObject* v8NpObject = npObjectToV8NPObject(npObject); 198 V8NPObject* v8NpObject = npObjectToV8NPObject(npObject);
199 if (!v8NpObject) 199 if (!v8NpObject)
200 return; 200 return;
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 622
623 convertV8ObjectToNPVariant(resultObject, npObject, result, isolate); 623 convertV8ObjectToNPVariant(resultObject, npObject, result, isolate);
624 return true; 624 return true;
625 } 625 }
626 626
627 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class-> construct) 627 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class-> construct)
628 return npObject->_class->construct(npObject, arguments, argumentCount, r esult); 628 return npObject->_class->construct(npObject, arguments, argumentCount, r esult);
629 629
630 return false; 630 return false;
631 } 631 }
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/NPV8Object.h ('k') | Source/bindings/core/v8/ScriptDebugServer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698