Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: src/Utils.h

Issue 29813591: Issue 6526 - Use Maybe<> version of soon to be deprecated API in v8 6.7 (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Left Patch Set: Created June 22, 2018, 8:54 p.m.
Right Patch Set: Throw on empty value (AsInt() and As Bool()) Created Aug. 7, 2018, 2:36 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« src/JsValue.cpp ('K') | « src/JsValue.cpp ('k') | test/JsValue.cpp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 v8::MaybeLocal<T>&& value, const v8::TryCatch* tryCatch, 45 v8::MaybeLocal<T>&& value, const v8::TryCatch* tryCatch,
46 const char* filename, int line) 46 const char* filename, int line)
47 { 47 {
48 if (tryCatch) 48 if (tryCatch)
49 CheckTryCatch(isolate, *tryCatch); 49 CheckTryCatch(isolate, *tryCatch);
50 if (value.IsEmpty()) 50 if (value.IsEmpty())
51 throw AdblockPlus::JsError("Empty value at ", filename, line); 51 throw AdblockPlus::JsError("Empty value at ", filename, line);
52 return value.ToLocalChecked(); 52 return value.ToLocalChecked();
53 } 53 }
54 54
55 #define CHECKED_TO_LOCAL(isolate, value, tryCatch) \ 55 #define CHECKED_TO_LOCAL_WITH_TRY_CATCH(isolate, value, tryCatch) \
56 AdblockPlus::Utils::CheckedToLocal(isolate, value, &tryCatch, __FILE__, __LI NE__) 56 AdblockPlus::Utils::CheckedToLocal((isolate), (value), &(tryCatch), __FILE__ , __LINE__)
57 57
58 #define CHECKED_TO_LOCAL_NOTHROW(isolate, value) \ 58 #define CHECKED_TO_LOCAL(isolate, value) \
59 AdblockPlus::Utils::CheckedToLocal(isolate, value, nullptr, __FILE__, __LINE __) 59 AdblockPlus::Utils::CheckedToLocal((isolate), (value), nullptr, __FILE__, __ LINE__)
60 60
61 /* 61 /*
62 * Check that a Maybe<> isn't empty, 62 * Check that a Maybe<> isn't empty,
63 * and throw a JsError if it is, otherwise return the value 63 * and throw a JsError if it is, otherwise return the value
64 * Call using the macro %CHECKED_TO_VALUE to get the location. 64 * Call using the macro %CHECKED_TO_VALUE to get the location.
65 */ 65 */
66 template<class T> 66 template<class T>
67 T CheckedToValue(v8::Maybe<T>&& value, const char* filename, int line) 67 T CheckedToValue(v8::Maybe<T>&& value, const char* filename, int line)
68 { 68 {
69 if (value.IsNothing()) 69 if (value.IsNothing())
(...skipping 22 matching lines...) Expand all
92 } 92 }
93 #ifdef _WIN32 93 #ifdef _WIN32
94 std::wstring ToUtf16String(const std::string& str); 94 std::wstring ToUtf16String(const std::string& str);
95 std::string ToUtf8String(const std::wstring& str); 95 std::string ToUtf8String(const std::wstring& str);
96 std::wstring CanonizeUrl(const std::wstring& url); 96 std::wstring CanonizeUrl(const std::wstring& url);
97 #endif 97 #endif
98 } 98 }
99 } 99 }
100 100
101 #endif 101 #endif
LEFTRIGHT

Powered by Google App Engine
This is Rietveld