From d9bc6f70781c5cdd8250e5be718633eab1e76f89 Mon Sep 17 00:00:00 2001 From: "svenpanne@chromium.org" Date: Tue, 10 Sep 2013 10:53:33 +0000 Subject: [PATCH] Move Maybe template into v8.h so it can be used by SetResourceConstraints BUG= R=svenpanne@chromium.org Review URL: https://codereview.chromium.org/23767009 Patch from Ross McIlroy . git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16607 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- include/v8.h | 15 +++++++++++++++ src/globals.h | 12 ------------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/include/v8.h b/include/v8.h index 5410334..7315b2a 100644 --- a/include/v8.h +++ b/include/v8.h @@ -817,6 +817,21 @@ class V8_EXPORT HandleScope { }; +/** + * A simple Maybe type, representing an object which may or may not have a + * value. + */ +template +struct Maybe { + Maybe() : has_value(false) {} + explicit Maybe(T t) : has_value(true), value(t) {} + Maybe(bool has, T t) : has_value(has), value(t) {} + + bool has_value; + T value; +}; + + // --- Special objects --- diff --git a/src/globals.h b/src/globals.h index d0a57a4..992f3a8 100644 --- a/src/globals.h +++ b/src/globals.h @@ -393,18 +393,6 @@ enum LanguageMode { }; -// A simple Maybe type, that can be passed by value. -template -struct Maybe { - Maybe() : has_value(false) {} - explicit Maybe(T t) : has_value(true), value(t) {} - Maybe(bool has, T t) : has_value(has), value(t) {} - - bool has_value; - T value; -}; - - // The Strict Mode (ECMA-262 5th edition, 4.2.2). // // This flag is used in the backend to represent the language mode. So far -- 2.7.4