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

Side by Side Diff: src/Utils.cpp

Issue 6193234183192576: Issue 1197 - change local copy of v8 (to 4.3.15) to work with Visual Studio 2013 (Closed)
Patch Set: rebase and update Created May 17, 2016, 3:18 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/Utils.h ('k') | src/WebRequestJsObject.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 else 42 else
43 return std::string(); 43 return std::string();
44 } 44 }
45 45
46 v8::Local<v8::String> Utils::ToV8String(v8::Isolate* isolate, const std::string& str) 46 v8::Local<v8::String> Utils::ToV8String(v8::Isolate* isolate, const std::string& str)
47 { 47 {
48 return v8::String::NewFromUtf8(isolate, str.c_str(), 48 return v8::String::NewFromUtf8(isolate, str.c_str(),
49 v8::String::NewStringType::kNormalString, str.length()); 49 v8::String::NewStringType::kNormalString, str.length());
50 } 50 }
51 51
52 void Utils::ThrowException(v8::Isolate* isolate, const std::string& str)
53 {
54 isolate->ThrowException(Utils::ToV8String(isolate, str));
55 }
52 56
53 #ifdef _WIN32 57 #ifdef _WIN32
54 std::wstring Utils::ToUtf16String(const std::string& str) 58 std::wstring Utils::ToUtf16String(const std::string& str)
55 { 59 {
56 size_t length = str.size(); 60 size_t length = str.size();
57 if (length == 0) 61 if (length == 0)
58 return std::wstring(); 62 return std::wstring();
59 63
60 DWORD utf16StringLength = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), length, NULL, 0); 64 DWORD utf16StringLength = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), length, NULL, 0);
61 if (utf16StringLength == 0) 65 if (utf16StringLength == 0)
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 if (FAILED(hr)) 101 if (FAILED(hr))
98 { 102 {
99 throw std::runtime_error("CanonizeUrl failed\n"); 103 throw std::runtime_error("CanonizeUrl failed\n");
100 } 104 }
101 } 105 }
102 return canonizedUrl; 106 return canonizedUrl;
103 107
104 } 108 }
105 #endif 109 #endif
106 110
OLDNEW
« no previous file with comments | « src/Utils.h ('k') | src/WebRequestJsObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld