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

Side by Side Diff: src/api.cc

Issue 12378069: Merged r13762 into 3.16 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.16
Patch Set: Created 7 years, 9 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 | « include/v8.h ('k') | src/messages.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 5302 matching lines...) Expand 10 before | Expand all | Expand 10 after
5313 i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value); 5313 i::Handle<i::Object> result = internal_isolate->factory()->NewNumber(value);
5314 return Utils::IntegerToLocal(result); 5314 return Utils::IntegerToLocal(result);
5315 } 5315 }
5316 5316
5317 5317
5318 void V8::IgnoreOutOfMemoryException() { 5318 void V8::IgnoreOutOfMemoryException() {
5319 EnterIsolateIfNeeded()->set_ignore_out_of_memory(true); 5319 EnterIsolateIfNeeded()->set_ignore_out_of_memory(true);
5320 } 5320 }
5321 5321
5322 5322
5323 bool V8::AddMessageListener(MessageCallback that) { 5323 bool V8::AddMessageListener(MessageCallback that, Handle<Value> data) {
5324 i::Isolate* isolate = i::Isolate::Current(); 5324 i::Isolate* isolate = i::Isolate::Current();
5325 EnsureInitializedForIsolate(isolate, "v8::V8::AddMessageListener()"); 5325 EnsureInitializedForIsolate(isolate, "v8::V8::AddMessageListener()");
5326 ON_BAILOUT(isolate, "v8::V8::AddMessageListener()", return false); 5326 ON_BAILOUT(isolate, "v8::V8::AddMessageListener()", return false);
5327 ENTER_V8(isolate); 5327 ENTER_V8(isolate);
5328 i::HandleScope scope(isolate); 5328 i::HandleScope scope(isolate);
5329 NeanderArray listeners(isolate->factory()->message_listeners()); 5329 NeanderArray listeners(isolate->factory()->message_listeners());
5330 listeners.add(isolate->factory()->NewForeign(FUNCTION_ADDR(that))); 5330 NeanderObject obj(2);
5331 obj.set(0, *isolate->factory()->NewForeign(FUNCTION_ADDR(that)));
5332 obj.set(1, data.IsEmpty() ? isolate->heap()->undefined_value()
5333 : *Utils::OpenHandle(*data));
5334 listeners.add(obj.value());
5331 return true; 5335 return true;
5332 } 5336 }
5333 5337
5334 5338
5335 void V8::RemoveMessageListeners(MessageCallback that) { 5339 void V8::RemoveMessageListeners(MessageCallback that) {
5336 i::Isolate* isolate = i::Isolate::Current(); 5340 i::Isolate* isolate = i::Isolate::Current();
5337 EnsureInitializedForIsolate(isolate, "v8::V8::RemoveMessageListener()"); 5341 EnsureInitializedForIsolate(isolate, "v8::V8::RemoveMessageListener()");
5338 ON_BAILOUT(isolate, "v8::V8::RemoveMessageListeners()", return); 5342 ON_BAILOUT(isolate, "v8::V8::RemoveMessageListeners()", return);
5339 ENTER_V8(isolate); 5343 ENTER_V8(isolate);
5340 i::HandleScope scope(isolate); 5344 i::HandleScope scope(isolate);
5341 NeanderArray listeners(isolate->factory()->message_listeners()); 5345 NeanderArray listeners(isolate->factory()->message_listeners());
5342 for (int i = 0; i < listeners.length(); i++) { 5346 for (int i = 0; i < listeners.length(); i++) {
5343 if (listeners.get(i)->IsUndefined()) continue; // skip deleted ones 5347 if (listeners.get(i)->IsUndefined()) continue; // skip deleted ones
5344 5348
5345 i::Handle<i::Foreign> callback_obj(i::Foreign::cast(listeners.get(i))); 5349 NeanderObject listener(i::JSObject::cast(listeners.get(i)));
5350 i::Handle<i::Foreign> callback_obj(i::Foreign::cast(listener.get(0)));
5346 if (callback_obj->foreign_address() == FUNCTION_ADDR(that)) { 5351 if (callback_obj->foreign_address() == FUNCTION_ADDR(that)) {
5347 listeners.set(i, isolate->heap()->undefined_value()); 5352 listeners.set(i, isolate->heap()->undefined_value());
5348 } 5353 }
5349 } 5354 }
5350 } 5355 }
5351 5356
5352 5357
5353 void V8::SetCaptureStackTraceForUncaughtExceptions( 5358 void V8::SetCaptureStackTraceForUncaughtExceptions(
5354 bool capture, 5359 bool capture,
5355 int frame_limit, 5360 int frame_limit,
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after
6695 6700
6696 v->VisitPointers(blocks_.first(), first_block_limit_); 6701 v->VisitPointers(blocks_.first(), first_block_limit_);
6697 6702
6698 for (int i = 1; i < blocks_.length(); i++) { 6703 for (int i = 1; i < blocks_.length(); i++) {
6699 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 6704 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
6700 } 6705 }
6701 } 6706 }
6702 6707
6703 6708
6704 } } // namespace v8::internal 6709 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/messages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698