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

Side by Side Diff: src/FileSystemJsObject.cpp

Issue 5163715573841920: Issue 768 - Switch from TR1 to C++11 (Closed)
Patch Set: fix including of <memory> Created Aug. 7, 2015, 6:07 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/DefaultFileSystem.cpp ('k') | src/FilterEngine.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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 : IoThread(jsEngine, callback), path(path) 53 : IoThread(jsEngine, callback), path(path)
54 { 54 {
55 } 55 }
56 56
57 void Run() 57 void Run()
58 { 58 {
59 std::string content; 59 std::string content;
60 std::string error; 60 std::string error;
61 try 61 try
62 { 62 {
63 std::tr1::shared_ptr<std::istream> stream = fileSystem->Read(path); 63 std::shared_ptr<std::istream> stream = fileSystem->Read(path);
64 content = Utils::Slurp(*stream); 64 content = Utils::Slurp(*stream);
65 } 65 }
66 catch (std::exception& e) 66 catch (std::exception& e)
67 { 67 {
68 error = e.what(); 68 error = e.what();
69 } 69 }
70 catch (...) 70 catch (...)
71 { 71 {
72 error = "Unknown error while reading from " + path; 72 error = "Unknown error while reading from " + path;
73 } 73 }
(...skipping 19 matching lines...) Expand all
93 const std::string& path, const std::string& content) 93 const std::string& path, const std::string& content)
94 : IoThread(jsEngine, callback), path(path), content(content) 94 : IoThread(jsEngine, callback), path(path), content(content)
95 { 95 {
96 } 96 }
97 97
98 void Run() 98 void Run()
99 { 99 {
100 std::string error; 100 std::string error;
101 try 101 try
102 { 102 {
103 std::tr1::shared_ptr<std::iostream> stream(new std::stringstream); 103 std::shared_ptr<std::iostream> stream(new std::stringstream);
104 *stream << content; 104 *stream << content;
105 fileSystem->Write(path, stream); 105 fileSystem->Write(path, stream);
106 } 106 }
107 catch (std::exception& e) 107 catch (std::exception& e)
108 { 108 {
109 error = e.what(); 109 error = e.what();
110 } 110 }
111 catch (...) 111 catch (...)
112 { 112 {
113 error = "Unknown error while writing to " + path; 113 error = "Unknown error while writing to " + path;
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 JsValuePtr FileSystemJsObject::Setup(JsEnginePtr jsEngine, JsValuePtr obj) 357 JsValuePtr FileSystemJsObject::Setup(JsEnginePtr jsEngine, JsValuePtr obj)
358 { 358 {
359 obj->SetProperty("read", jsEngine->NewCallback(::ReadCallback)); 359 obj->SetProperty("read", jsEngine->NewCallback(::ReadCallback));
360 obj->SetProperty("write", jsEngine->NewCallback(::WriteCallback)); 360 obj->SetProperty("write", jsEngine->NewCallback(::WriteCallback));
361 obj->SetProperty("move", jsEngine->NewCallback(::MoveCallback)); 361 obj->SetProperty("move", jsEngine->NewCallback(::MoveCallback));
362 obj->SetProperty("remove", jsEngine->NewCallback(::RemoveCallback)); 362 obj->SetProperty("remove", jsEngine->NewCallback(::RemoveCallback));
363 obj->SetProperty("stat", jsEngine->NewCallback(::StatCallback)); 363 obj->SetProperty("stat", jsEngine->NewCallback(::StatCallback));
364 obj->SetProperty("resolve", jsEngine->NewCallback(::ResolveCallback)); 364 obj->SetProperty("resolve", jsEngine->NewCallback(::ResolveCallback));
365 return obj; 365 return obj;
366 } 366 }
OLDNEW
« no previous file with comments | « src/DefaultFileSystem.cpp ('k') | src/FilterEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld