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

Unified Diff: test/cctest/test-debug.cc

Issue 1940: Replaced calls to functions that msvc consider deprecated. Used... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/test-compiler.cc ('k') | test/cctest/test-utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-debug.cc
===================================================================
--- test/cctest/test-debug.cc (revision 280)
+++ test/cctest/test-debug.cc (working copy)
@@ -35,6 +35,8 @@
#include "stub-cache.h"
#include "cctest.h"
+
+using ::v8::internal::EmbeddedVector;
using ::v8::internal::Object;
using ::v8::internal::OS;
using ::v8::internal::Handle;
@@ -203,33 +205,34 @@
// associated break point number.
static int SetBreakPointFromJS(const char* function_name,
int line, int position) {
- char buffer[SMALL_STRING_BUFFER_SIZE];
- OS::SNPrintF(buffer, SMALL_STRING_BUFFER_SIZE,
+ EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
+ OS::SNPrintF(buffer,
"debug.Debug.setBreakPoint(%s,%d,%d)",
function_name, line, position);
buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
- return v8::Script::Compile(v8::String::New(buffer))->Run()->Int32Value();
+ v8::Handle<v8::String> str = v8::String::New(buffer.start());
+ return v8::Script::Compile(str)->Run()->Int32Value();
}
// Set a break point in a script using the global Debug object.
static int SetScriptBreakPointFromJS(const char* script_data,
int line, int column) {
- char buffer[SMALL_STRING_BUFFER_SIZE];
+ EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
if (column >= 0) {
// Column specified set script break point on precise location.
- OS::SNPrintF(buffer, SMALL_STRING_BUFFER_SIZE,
+ OS::SNPrintF(buffer,
"debug.Debug.setScriptBreakPoint(\"%s\",%d,%d)",
script_data, line, column);
} else {
// Column not specified set script break point on line.
- OS::SNPrintF(buffer, SMALL_STRING_BUFFER_SIZE,
+ OS::SNPrintF(buffer,
"debug.Debug.setScriptBreakPoint(\"%s\",%d)",
script_data, line);
}
buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
-
- return v8::Script::Compile(v8::String::New(buffer))->Run()->Int32Value();
+ v8::Handle<v8::String> str = v8::String::New(buffer.start());
+ return v8::Script::Compile(str)->Run()->Int32Value();
}
@@ -242,54 +245,54 @@
// Clear a break point using the global Debug object.
static void ClearBreakPointFromJS(int break_point_number) {
- char buffer[SMALL_STRING_BUFFER_SIZE];
- OS::SNPrintF(buffer, SMALL_STRING_BUFFER_SIZE,
+ EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
+ OS::SNPrintF(buffer,
"debug.Debug.clearBreakPoint(%d)",
break_point_number);
buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
- v8::Script::Compile(v8::String::New(buffer))->Run();
+ v8::Script::Compile(v8::String::New(buffer.start()))->Run();
}
static void EnableScriptBreakPointFromJS(int break_point_number) {
- char buffer[SMALL_STRING_BUFFER_SIZE];
- OS::SNPrintF(buffer, SMALL_STRING_BUFFER_SIZE,
+ EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
+ OS::SNPrintF(buffer,
"debug.Debug.enableScriptBreakPoint(%d)",
break_point_number);
buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
- v8::Script::Compile(v8::String::New(buffer))->Run();
+ v8::Script::Compile(v8::String::New(buffer.start()))->Run();
}
static void DisableScriptBreakPointFromJS(int break_point_number) {
- char buffer[SMALL_STRING_BUFFER_SIZE];
- OS::SNPrintF(buffer, SMALL_STRING_BUFFER_SIZE,
+ EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
+ OS::SNPrintF(buffer,
"debug.Debug.disableScriptBreakPoint(%d)",
break_point_number);
buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
- v8::Script::Compile(v8::String::New(buffer))->Run();
+ v8::Script::Compile(v8::String::New(buffer.start()))->Run();
}
static void ChangeScriptBreakPointConditionFromJS(int break_point_number,
const char* condition) {
- char buffer[SMALL_STRING_BUFFER_SIZE];
- OS::SNPrintF(buffer, SMALL_STRING_BUFFER_SIZE,
+ EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
+ OS::SNPrintF(buffer,
"debug.Debug.changeScriptBreakPointCondition(%d, \"%s\")",
break_point_number, condition);
buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
- v8::Script::Compile(v8::String::New(buffer))->Run();
+ v8::Script::Compile(v8::String::New(buffer.start()))->Run();
}
static void ChangeScriptBreakPointIgnoreCountFromJS(int break_point_number,
int ignoreCount) {
- char buffer[SMALL_STRING_BUFFER_SIZE];
- OS::SNPrintF(buffer, SMALL_STRING_BUFFER_SIZE,
+ EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
+ OS::SNPrintF(buffer,
"debug.Debug.changeScriptBreakPointIgnoreCount(%d, %d)",
break_point_number, ignoreCount);
buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
- v8::Script::Compile(v8::String::New(buffer))->Run();
+ v8::Script::Compile(v8::String::New(buffer.start()))->Run();
}
« no previous file with comments | « test/cctest/test-compiler.cc ('k') | test/cctest/test-utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698