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

Side by Side Diff: src/api.cc

Issue 20053006: ArrayBuffer::BaseAddress() method. Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 7 years, 4 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 | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 6323 matching lines...) Expand 10 before | Expand all | Expand 10 after
6334 6334
6335 6335
6336 size_t v8::ArrayBuffer::ByteLength() const { 6336 size_t v8::ArrayBuffer::ByteLength() const {
6337 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 6337 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
6338 if (IsDeadCheck(isolate, "v8::ArrayBuffer::ByteLength()")) return 0; 6338 if (IsDeadCheck(isolate, "v8::ArrayBuffer::ByteLength()")) return 0;
6339 i::Handle<i::JSArrayBuffer> obj = Utils::OpenHandle(this); 6339 i::Handle<i::JSArrayBuffer> obj = Utils::OpenHandle(this);
6340 return static_cast<size_t>(obj->byte_length()->Number()); 6340 return static_cast<size_t>(obj->byte_length()->Number());
6341 } 6341 }
6342 6342
6343 6343
6344 void* v8::ArrayBuffer::BaseAddress() {
6345 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
6346 if (IsDeadCheck(isolate, "v8::ArrayBuffer::ByteLength()")) return 0;
6347 i::Handle<i::JSArrayBuffer> obj = Utils::OpenHandle(this);
6348 return obj->backing_store();
6349 }
6350
6351
6344 Local<ArrayBuffer> v8::ArrayBuffer::New(size_t byte_length) { 6352 Local<ArrayBuffer> v8::ArrayBuffer::New(size_t byte_length) {
6345 i::Isolate* isolate = i::Isolate::Current(); 6353 i::Isolate* isolate = i::Isolate::Current();
6346 EnsureInitializedForIsolate(isolate, "v8::ArrayBuffer::New(size_t)"); 6354 EnsureInitializedForIsolate(isolate, "v8::ArrayBuffer::New(size_t)");
6347 LOG_API(isolate, "v8::ArrayBuffer::New(size_t)"); 6355 LOG_API(isolate, "v8::ArrayBuffer::New(size_t)");
6348 ENTER_V8(isolate); 6356 ENTER_V8(isolate);
6349 i::Handle<i::JSArrayBuffer> obj = 6357 i::Handle<i::JSArrayBuffer> obj =
6350 isolate->factory()->NewJSArrayBuffer(); 6358 isolate->factory()->NewJSArrayBuffer();
6351 i::Runtime::SetupArrayBufferAllocatingData(isolate, obj, byte_length); 6359 i::Runtime::SetupArrayBufferAllocatingData(isolate, obj, byte_length);
6352 return Utils::ToLocal(obj); 6360 return Utils::ToLocal(obj);
6353 } 6361 }
(...skipping 1698 matching lines...) Expand 10 before | Expand all | Expand 10 after
8052 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 8060 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
8053 Address callback_address = 8061 Address callback_address =
8054 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8062 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8055 VMState<EXTERNAL> state(isolate); 8063 VMState<EXTERNAL> state(isolate);
8056 ExternalCallbackScope call_scope(isolate, callback_address); 8064 ExternalCallbackScope call_scope(isolate, callback_address);
8057 return callback(info); 8065 return callback(info);
8058 } 8066 }
8059 8067
8060 8068
8061 } } // namespace v8::internal 8069 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698