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

Side by Side Diff: Source/bindings/core/v8/custom/V8ArrayBufferCustom.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
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 WrapperTypeInfo::RefCountedObject 58 WrapperTypeInfo::RefCountedObject
59 }; 59 };
60 60
61 bool V8ArrayBuffer::hasInstance(v8::Handle<v8::Value> value, v8::Isolate*) 61 bool V8ArrayBuffer::hasInstance(v8::Handle<v8::Value> value, v8::Isolate*)
62 { 62 {
63 return value->IsArrayBuffer(); 63 return value->IsArrayBuffer();
64 } 64 }
65 65
66 void V8ArrayBuffer::refObject(ScriptWrappableBase* internalPointer) 66 void V8ArrayBuffer::refObject(ScriptWrappableBase* internalPointer)
67 { 67 {
68 fromInternalPointer(internalPointer)->ref(); 68 toImpl(internalPointer)->ref();
69 } 69 }
70 70
71 void V8ArrayBuffer::derefObject(ScriptWrappableBase* internalPointer) 71 void V8ArrayBuffer::derefObject(ScriptWrappableBase* internalPointer)
72 { 72 {
73 fromInternalPointer(internalPointer)->deref(); 73 toImpl(internalPointer)->deref();
74 } 74 }
75 75
76 WrapperPersistentNode* V8ArrayBuffer::createPersistentHandle(ScriptWrappableBase * internalPointer) 76 WrapperPersistentNode* V8ArrayBuffer::createPersistentHandle(ScriptWrappableBase * internalPointer)
77 { 77 {
78 ASSERT_NOT_REACHED(); 78 ASSERT_NOT_REACHED();
79 return 0; 79 return 0;
80 } 80 }
81 81
82 v8::Handle<v8::Object> V8ArrayBuffer::createWrapper(PassRefPtr<ArrayBuffer> impl , v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 82 v8::Handle<v8::Object> V8ArrayBuffer::createWrapper(PassRefPtr<ArrayBuffer> impl , v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
83 { 83 {
84 ASSERT(impl.get()); 84 ASSERT(impl.get());
85 ASSERT(!DOMDataStore::containsWrapper<V8ArrayBuffer>(impl.get(), isolate)); 85 ASSERT(!DOMDataStore::containsWrapper<V8ArrayBuffer>(impl.get(), isolate));
86 86
87 v8::Handle<v8::Object> wrapper = v8::ArrayBuffer::New(isolate, impl->data(), impl->byteLength()); 87 v8::Handle<v8::Object> wrapper = v8::ArrayBuffer::New(isolate, impl->data(), impl->byteLength());
88 impl->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instanceTem plate()); 88 impl->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instanceTem plate());
89 89
90 V8DOMWrapper::associateObjectWithWrapper<V8ArrayBuffer>(impl, &wrapperTypeIn fo, wrapper, isolate); 90 V8DOMWrapper::associateObjectWithWrapper<V8ArrayBuffer>(impl, &wrapperTypeIn fo, wrapper, isolate);
91 return wrapper; 91 return wrapper;
92 } 92 }
93 93
94 ArrayBuffer* V8ArrayBuffer::toNative(v8::Handle<v8::Object> object) 94 ArrayBuffer* V8ArrayBuffer::toImpl(v8::Handle<v8::Object> object)
95 { 95 {
96 ASSERT(object->IsArrayBuffer()); 96 ASSERT(object->IsArrayBuffer());
97 v8::Local<v8::ArrayBuffer> v8buffer = object.As<v8::ArrayBuffer>(); 97 v8::Local<v8::ArrayBuffer> v8buffer = object.As<v8::ArrayBuffer>();
98 if (v8buffer->IsExternal()) { 98 if (v8buffer->IsExternal()) {
99 RELEASE_ASSERT(toWrapperTypeInfo(object)->ginEmbedder == gin::kEmbedderB link); 99 RELEASE_ASSERT(toWrapperTypeInfo(object)->ginEmbedder == gin::kEmbedderB link);
100 return reinterpret_cast<ArrayBuffer*>(blink::toInternalPointer(object)); 100 return reinterpret_cast<ArrayBuffer*>(blink::toScriptWrappableBase(objec t));
101 } 101 }
102 102
103 v8::ArrayBuffer::Contents v8Contents = v8buffer->Externalize(); 103 v8::ArrayBuffer::Contents v8Contents = v8buffer->Externalize();
104 ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength(), 104 ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength(),
105 V8ArrayBufferDeallocationObserver::instanceTemplate()); 105 V8ArrayBufferDeallocationObserver::instanceTemplate());
106 RefPtr<ArrayBuffer> buffer = ArrayBuffer::create(contents); 106 RefPtr<ArrayBuffer> buffer = ArrayBuffer::create(contents);
107 V8DOMWrapper::associateObjectWithWrapper<V8ArrayBuffer>(buffer.release(), &w rapperTypeInfo, object, v8::Isolate::GetCurrent()); 107 V8DOMWrapper::associateObjectWithWrapper<V8ArrayBuffer>(buffer.release(), &w rapperTypeInfo, object, v8::Isolate::GetCurrent());
108 108
109 return reinterpret_cast<ArrayBuffer*>(blink::toInternalPointer(object)); 109 return reinterpret_cast<ArrayBuffer*>(blink::toScriptWrappableBase(object));
110 } 110 }
111 111
112 ArrayBuffer* V8ArrayBuffer::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Hand le<v8::Value> value) 112 ArrayBuffer* V8ArrayBuffer::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle <v8::Value> value)
113 { 113 {
114 return V8ArrayBuffer::hasInstance(value, isolate) ? V8ArrayBuffer::toNative( v8::Handle<v8::Object>::Cast(value)) : 0; 114 return V8ArrayBuffer::hasInstance(value, isolate) ? V8ArrayBuffer::toImpl(v8 ::Handle<v8::Object>::Cast(value)) : 0;
115 } 115 }
116 116
117 template<> 117 template<>
118 v8::Handle<v8::Value> toV8NoInline(ArrayBuffer* impl, v8::Handle<v8::Object> cre ationContext, v8::Isolate* isolate) 118 v8::Handle<v8::Value> toV8NoInline(ArrayBuffer* impl, v8::Handle<v8::Object> cre ationContext, v8::Isolate* isolate)
119 { 119 {
120 return toV8(impl, creationContext, isolate); 120 return toV8(impl, creationContext, isolate);
121 } 121 }
122 122
123 } // namespace blink 123 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/custom/V8ArrayBufferCustom.h ('k') | Source/bindings/core/v8/custom/V8ArrayBufferViewCustom.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698