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

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

Issue 16206014: Add Persistent::Upcast. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: . Created 7 years, 6 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') | 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 2867 matching lines...) Expand 10 before | Expand all | Expand 10 after
2878 String* str = global.ClearAndLeak(); 2878 String* str = global.ClearAndLeak();
2879 CHECK(global.IsEmpty()); 2879 CHECK(global.IsEmpty());
2880 CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count + 1); 2880 CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count + 1);
2881 v8::Persistent<String>* new_global = 2881 v8::Persistent<String>* new_global =
2882 reinterpret_cast<v8::Persistent<String>*>(&str); 2882 reinterpret_cast<v8::Persistent<String>*>(&str);
2883 new_global->Dispose(); 2883 new_global->Dispose();
2884 CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count); 2884 CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count);
2885 } 2885 }
2886 2886
2887 2887
2888 THREADED_TEST(GlobalHandleUpcast) {
2889 v8::Isolate* isolate = v8::Isolate::GetCurrent();
2890 v8::HandleScope scope(isolate);
2891 v8::Local<String> local = v8::Local<String>::New(v8_str("str"));
2892 v8::Persistent<String> global_string(isolate, local);
2893 #ifdef V8_USE_UNSAFE_HANDLES
2894 v8::Persistent<Value> global_value =
2895 v8::Persistent<Value>::Cast(global_string);
2896 #else
2897 v8::Persistent<Value>& global_value =
2898 v8::Persistent<Value>::Cast(global_string);
2899 #endif
2900 CHECK(v8::Local<v8::Value>::New(isolate, global_value)->IsString());
2901 CHECK(global_string == v8::Persistent<String>::Cast(global_value));
2902 global_string.Dispose();
2903 }
2904
2905
2888 THREADED_TEST(LocalHandle) { 2906 THREADED_TEST(LocalHandle) {
2889 v8::HandleScope scope(v8::Isolate::GetCurrent()); 2907 v8::HandleScope scope(v8::Isolate::GetCurrent());
2890 v8::Local<String> local = v8::Local<String>::New(v8_str("str")); 2908 v8::Local<String> local = v8::Local<String>::New(v8_str("str"));
2891 CHECK_EQ(local->Length(), 3); 2909 CHECK_EQ(local->Length(), 3);
2892 2910
2893 local = v8::Local<String>::New(v8::Isolate::GetCurrent(), v8_str("str")); 2911 local = v8::Local<String>::New(v8::Isolate::GetCurrent(), v8_str("str"));
2894 CHECK_EQ(local->Length(), 3); 2912 CHECK_EQ(local->Length(), 3);
2895 } 2913 }
2896 2914
2897 2915
(...skipping 16210 matching lines...) Expand 10 before | Expand all | Expand 10 after
19108 i::Semaphore* sem_; 19126 i::Semaphore* sem_;
19109 volatile int sem_value_; 19127 volatile int sem_value_;
19110 }; 19128 };
19111 19129
19112 19130
19113 THREADED_TEST(SemaphoreInterruption) { 19131 THREADED_TEST(SemaphoreInterruption) {
19114 ThreadInterruptTest().RunTest(); 19132 ThreadInterruptTest().RunTest();
19115 } 19133 }
19116 19134
19117 #endif // WIN32 19135 #endif // WIN32
OLDNEW
« no previous file with comments | « include/v8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698