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

Unified Diff: test/cctest/print-extension.cc

Issue 138843005: Merge missing r18658 from bleeding_edge and add missing files. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Add missing files. Created 6 years, 11 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 | « test/cctest/print-extension.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/print-extension.cc
diff --git a/src/extensions/free-buffer-extension.cc b/test/cctest/print-extension.cc
similarity index 73%
copy from src/extensions/free-buffer-extension.cc
copy to test/cctest/print-extension.cc
index b4abaafe237aec39a0a1183cd20f244fd0eca5e8..9f629195bd7909c1a97760484cea37b600461b98 100644
--- a/src/extensions/free-buffer-extension.cc
+++ b/test/cctest/print-extension.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 the V8 project authors. All rights reserved.
+// Copyright 2014 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -25,26 +25,27 @@
// (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 "print-extension.h"
namespace v8 {
namespace internal {
-
-v8::Handle<v8::FunctionTemplate> FreeBufferExtension::GetNativeFunctionTemplate(
+v8::Handle<v8::FunctionTemplate> PrintExtension::GetNativeFunctionTemplate(
v8::Isolate* isolate,
v8::Handle<v8::String> str) {
- return v8::FunctionTemplate::New(isolate, FreeBufferExtension::FreeBuffer);
+ return v8::FunctionTemplate::New(isolate, PrintExtension::Print);
}
-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 PrintExtension::Print(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ for (int i = 0; i < args.Length(); i++) {
+ if (i != 0) printf(" ");
+ v8::HandleScope scope(args.GetIsolate());
+ v8::String::Utf8Value str(args[i]);
+ if (*str == NULL) return;
+ printf("%s", *str);
+ }
+ printf("\n");
}
} } // namespace v8::internal
« no previous file with comments | « test/cctest/print-extension.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698