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

Side by Side Diff: test/cctest/test-api.cc

Issue 985873002: api: introduce SealHandleScope (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: set limit as internal SealHandleScope does Created 5 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
« src/api.cc ('K') | « test/cctest/cctest.status ('k') | 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 21627 matching lines...) Expand 10 before | Expand all | Expand 10 after
21638 } 21638 }
21639 { 21639 {
21640 v8::TryCatch try_catch; 21640 v8::TryCatch try_catch;
21641 uint16_t* data = reinterpret_cast<uint16_t*>(buffer); 21641 uint16_t* data = reinterpret_cast<uint16_t*>(buffer);
21642 CHECK(v8::String::NewFromTwoByte(isolate, data, v8::String::kNormalString, 21642 CHECK(v8::String::NewFromTwoByte(isolate, data, v8::String::kNormalString,
21643 length).IsEmpty()); 21643 length).IsEmpty());
21644 CHECK(try_catch.HasCaught()); 21644 CHECK(try_catch.HasCaught());
21645 } 21645 }
21646 free(buffer); 21646 free(buffer);
21647 } 21647 }
21648
21649
21650 TEST(SealHandleScope) {
21651 v8::Isolate* isolate = CcTest::isolate();
21652 v8::HandleScope handle_scope(isolate);
21653 LocalContext env;
21654
21655 v8::SealHandleScope seal(isolate);
21656
21657 // Should fail
21658 v8::Local<v8::Object> obj = v8::Object::New(isolate);
21659
21660 // Just to silence warning
21661 CHECK(!obj.IsEmpty());
Yang 2015/03/13 07:18:20 You can use USE(obj);
21662 }
21663
21664
21665 TEST(SealHandleScopeNested) {
21666 v8::Isolate* isolate = CcTest::isolate();
21667 v8::HandleScope handle_scope(isolate);
21668 LocalContext env;
21669
21670 v8::SealHandleScope seal(isolate);
21671
21672 {
21673 v8::HandleScope handle_scope(isolate);
21674
21675 // Should work
21676 v8::Local<v8::Object> obj = v8::Object::New(isolate);
21677
21678 // Just to silence warning
21679 CHECK(!obj.IsEmpty());
Yang 2015/03/13 07:18:20 Same here.
21680 }
21681 }
OLDNEW
« src/api.cc ('K') | « test/cctest/cctest.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698