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

Side by Side Diff: src/Utils.cpp

Issue 6112412478472192: Issue 1547 - Pass isolate to v8::API (Closed)
Patch Set: remove new empty lines Created Feb. 9, 2015, 11:02 a.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-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 25 matching lines...) Expand all
36 36
37 std::string Utils::FromV8String(v8::Handle<v8::Value> value) 37 std::string Utils::FromV8String(v8::Handle<v8::Value> value)
38 { 38 {
39 v8::String::Utf8Value stringValue(value); 39 v8::String::Utf8Value stringValue(value);
40 if (stringValue.length()) 40 if (stringValue.length())
41 return std::string(*stringValue, stringValue.length()); 41 return std::string(*stringValue, stringValue.length());
42 else 42 else
43 return std::string(); 43 return std::string();
44 } 44 }
45 45
46 v8::Local<v8::String> Utils::ToV8String(const std::string& str) 46 v8::Local<v8::String> Utils::ToV8String(v8::Isolate* isolate, const std::string& str)
47 { 47 {
48 return v8::String::New(str.c_str(), str.length()); 48 return v8::String::NewFromUtf8(isolate, str.c_str(),
49 v8::String::NewStringType::kNormalString, str.length());
49 } 50 }
50 51
51 52
52 #ifdef _WIN32 53 #ifdef _WIN32
53 std::wstring Utils::ToUtf16String(const std::string& str) 54 std::wstring Utils::ToUtf16String(const std::string& str)
54 { 55 {
55 size_t length = str.size(); 56 size_t length = str.size();
56 if (length == 0) 57 if (length == 0)
57 return std::wstring(); 58 return std::wstring();
58 59
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 if (FAILED(hr)) 97 if (FAILED(hr))
97 { 98 {
98 throw std::runtime_error("CanonizeUrl failed\n"); 99 throw std::runtime_error("CanonizeUrl failed\n");
99 } 100 }
100 } 101 }
101 return canonizedUrl; 102 return canonizedUrl;
102 103
103 } 104 }
104 #endif 105 #endif
105 106
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