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: Created July 11, 2014, 2:24 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
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 JsValuePtr FileSystemJsObject::Setup(JsEnginePtr jsEngine, JsValuePtr obj) 351 JsValuePtr FileSystemJsObject::Setup(JsEnginePtr jsEngine, JsValuePtr obj)
352 { 352 {
353 obj->SetProperty("read", jsEngine->NewCallback(::ReadCallback)); 353 obj->SetProperty("read", jsEngine->NewCallback(::ReadCallback));
354 obj->SetProperty("write", jsEngine->NewCallback(::WriteCallback)); 354 obj->SetProperty("write", jsEngine->NewCallback(::WriteCallback));
355 obj->SetProperty("move", jsEngine->NewCallback(::MoveCallback)); 355 obj->SetProperty("move", jsEngine->NewCallback(::MoveCallback));
356 obj->SetProperty("remove", jsEngine->NewCallback(::RemoveCallback)); 356 obj->SetProperty("remove", jsEngine->NewCallback(::RemoveCallback));
357 obj->SetProperty("stat", jsEngine->NewCallback(::StatCallback)); 357 obj->SetProperty("stat", jsEngine->NewCallback(::StatCallback));
358 obj->SetProperty("resolve", jsEngine->NewCallback(::ResolveCallback)); 358 obj->SetProperty("resolve", jsEngine->NewCallback(::ResolveCallback));
359 return obj; 359 return obj;
360 } 360 }
OLDNEW

Powered by Google App Engine
This is Rietveld