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

Unified Diff: src/extensions/free-buffer-extension.cc

Issue 148343005: A64: Synchronize with r18147. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/extensions/free-buffer-extension.h ('k') | src/extensions/gc-extension.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/extensions/free-buffer-extension.cc
diff --git a/src/default-platform.cc b/src/extensions/free-buffer-extension.cc
similarity index 65%
copy from src/default-platform.cc
copy to src/extensions/free-buffer-extension.cc
index ef3c4ebd450bbc63ae99b4534a22fa5bd67a2f39..5cf2b68146c9d325096b6f94172bca55d498c2fa 100644
--- a/src/default-platform.cc
+++ b/src/extensions/free-buffer-extension.cc
@@ -25,32 +25,36 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#include "free-buffer-extension.h"
+#include "platform.h"
#include "v8.h"
-#include "default-platform.h"
-
namespace v8 {
namespace internal {
-DefaultPlatform::DefaultPlatform() {}
-
+v8::Handle<v8::FunctionTemplate> FreeBufferExtension::GetNativeFunctionTemplate(
+ v8::Isolate* isolate,
+ v8::Handle<v8::String> str) {
+ return v8::FunctionTemplate::New(FreeBufferExtension::FreeBuffer);
+}
-DefaultPlatform::~DefaultPlatform() {}
-void DefaultPlatform::CallOnBackgroundThread(Task *task,
- ExpectedRuntime expected_runtime) {
- // TODO(jochen): implement.
- task->Run();
- delete task;
+void FreeBufferExtension::FreeBuffer(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
+ v8::Handle<v8::ArrayBuffer> arrayBuffer = args[0].As<v8::ArrayBuffer>();
+ v8::ArrayBuffer::Contents contents = arrayBuffer->Externalize();
+ V8::ArrayBufferAllocator()->Free(contents.Data(), contents.ByteLength());
}
-void DefaultPlatform::CallOnForegroundThread(v8::Isolate* isolate, Task* task) {
- // TODO(jochen): implement.
- task->Run();
- delete task;
-}
+void FreeBufferExtension::Register() {
+ static char buffer[100];
+ Vector<char> temp_vector(buffer, sizeof(buffer));
+ OS::SNPrintF(temp_vector, "native function freeBuffer();");
+ static FreeBufferExtension buffer_free_extension(buffer);
+ static v8::DeclareExtension declaration(&buffer_free_extension);
+}
} } // namespace v8::internal
« no previous file with comments | « src/extensions/free-buffer-extension.h ('k') | src/extensions/gc-extension.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698