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: include/v8.h

Issue 23767009: Move Maybe template into v8.h so it can be used by SetResourceConstraints (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/globals.h » ('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 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 870
871 // Allow for the active closing of HandleScopes which allows to pass a handle 871 // Allow for the active closing of HandleScopes which allows to pass a handle
872 // from the HandleScope being closed to the next top most HandleScope. 872 // from the HandleScope being closed to the next top most HandleScope.
873 bool is_closed_; 873 bool is_closed_;
874 internal::Object** RawClose(internal::Object** value); 874 internal::Object** RawClose(internal::Object** value);
875 875
876 friend class ImplementationUtilities; 876 friend class ImplementationUtilities;
877 }; 877 };
878 878
879 879
880 /**
881 * A simple Maybe type, representing an object which may or may not have a
882 * value.
883 */
884 template<class T>
885 struct Maybe {
886 Maybe() : has_value(false) {}
887 explicit Maybe(T t) : has_value(true), value(t) {}
888 Maybe(bool has, T t) : has_value(has), value(t) {}
889
890 bool has_value;
891 T value;
892 };
893
894
880 // --- Special objects --- 895 // --- Special objects ---
881 896
882 897
883 /** 898 /**
884 * The superclass of values and API object templates. 899 * The superclass of values and API object templates.
885 */ 900 */
886 class V8_EXPORT Data { 901 class V8_EXPORT Data {
887 private: 902 private:
888 Data(); 903 Data();
889 }; 904 };
(...skipping 5644 matching lines...) Expand 10 before | Expand all | Expand 10 after
6534 */ 6549 */
6535 6550
6536 6551
6537 } // namespace v8 6552 } // namespace v8
6538 6553
6539 6554
6540 #undef TYPE_CHECK 6555 #undef TYPE_CHECK
6541 6556
6542 6557
6543 #endif // V8_H_ 6558 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698