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

Side by Side Diff: src/api.cc

Issue 239513006: Protect against API abuse. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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 | no next file » | 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 6273 matching lines...) Expand 10 before | Expand all | Expand 10 after
6284 StackTrace::StackTraceOptions options) { 6284 StackTrace::StackTraceOptions options) {
6285 i::Isolate::Current()->SetCaptureStackTraceForUncaughtExceptions( 6285 i::Isolate::Current()->SetCaptureStackTraceForUncaughtExceptions(
6286 capture, 6286 capture,
6287 frame_limit, 6287 frame_limit,
6288 options); 6288 options);
6289 } 6289 }
6290 6290
6291 6291
6292 void V8::SetCounterFunction(CounterLookupCallback callback) { 6292 void V8::SetCounterFunction(CounterLookupCallback callback) {
6293 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); 6293 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
6294 // TODO(svenpanne) The Isolate should really be a parameter.
6295 if (isolate == NULL) return;
6294 isolate->stats_table()->SetCounterFunction(callback); 6296 isolate->stats_table()->SetCounterFunction(callback);
6295 } 6297 }
6296 6298
6297 6299
6298 void V8::SetCreateHistogramFunction(CreateHistogramCallback callback) { 6300 void V8::SetCreateHistogramFunction(CreateHistogramCallback callback) {
6299 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); 6301 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
6302 // TODO(svenpanne) The Isolate should really be a parameter.
6303 if (isolate == NULL) return;
6300 isolate->stats_table()->SetCreateHistogramFunction(callback); 6304 isolate->stats_table()->SetCreateHistogramFunction(callback);
6301 isolate->InitializeLoggingAndCounters(); 6305 isolate->InitializeLoggingAndCounters();
6302 isolate->counters()->ResetHistograms(); 6306 isolate->counters()->ResetHistograms();
6303 } 6307 }
6304 6308
6305 6309
6306 void V8::SetAddHistogramSampleFunction(AddHistogramSampleCallback callback) { 6310 void V8::SetAddHistogramSampleFunction(AddHistogramSampleCallback callback) {
6307 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); 6311 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
6312 // TODO(svenpanne) The Isolate should really be a parameter.
6313 if (isolate == NULL) return;
6308 isolate->stats_table()-> 6314 isolate->stats_table()->
6309 SetAddHistogramSampleFunction(callback); 6315 SetAddHistogramSampleFunction(callback);
6310 } 6316 }
6311 6317
6312 void V8::SetFailedAccessCheckCallbackFunction( 6318 void V8::SetFailedAccessCheckCallbackFunction(
6313 FailedAccessCheckCallback callback) { 6319 FailedAccessCheckCallback callback) {
6314 i::Isolate* isolate = i::Isolate::Current(); 6320 i::Isolate* isolate = i::Isolate::Current();
6315 isolate->SetFailedAccessCheckCallback(callback); 6321 isolate->SetFailedAccessCheckCallback(callback);
6316 } 6322 }
6317 6323
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after
7608 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7614 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7609 Address callback_address = 7615 Address callback_address =
7610 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7616 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7611 VMState<EXTERNAL> state(isolate); 7617 VMState<EXTERNAL> state(isolate);
7612 ExternalCallbackScope call_scope(isolate, callback_address); 7618 ExternalCallbackScope call_scope(isolate, callback_address);
7613 callback(info); 7619 callback(info);
7614 } 7620 }
7615 7621
7616 7622
7617 } } // namespace v8::internal 7623 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698