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

Side by Side Diff: src/DefaultFileSystem.h

Issue 29499630: Issue 4938 - fix race conditions and get rid of hacks related to DefaultFileSystem (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: Created July 27, 2017, 11:15 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 | « include/AdblockPlus/JsEngine.h ('k') | src/DefaultFileSystem.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-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 #ifndef ADBLOCK_PLUS_DEFAULT_FILE_SYSTEM_H 18 #ifndef ADBLOCK_PLUS_DEFAULT_FILE_SYSTEM_H
19 #define ADBLOCK_PLUS_DEFAULT_FILE_SYSTEM_H 19 #define ADBLOCK_PLUS_DEFAULT_FILE_SYSTEM_H
20 20
21 #include <AdblockPlus/IFileSystem.h> 21 #include <AdblockPlus/IFileSystem.h>
22 #include <AdblockPlus/Scheduler.h>
22 23
23 #ifdef _WIN32 24 #ifdef _WIN32
24 #define PATH_SEPARATOR '\\' 25 #define PATH_SEPARATOR '\\'
25 #else 26 #else
26 #define PATH_SEPARATOR '/' 27 #define PATH_SEPARATOR '/'
27 #endif 28 #endif
28 29
29 namespace AdblockPlus 30 namespace AdblockPlus
30 { 31 {
31 /** 32 /**
(...skipping 18 matching lines...) Expand all
50 */ 51 */
51 void SetBasePath(const std::string& path); 52 void SetBasePath(const std::string& path);
52 53
53 protected: 54 protected:
54 std::string basePath; 55 std::string basePath;
55 }; 56 };
56 57
57 class DefaultFileSystem : public IFileSystem 58 class DefaultFileSystem : public IFileSystem
58 { 59 {
59 public: 60 public:
60 explicit DefaultFileSystem(std::unique_ptr<DefaultFileSystemSync> syncImpl); 61 explicit DefaultFileSystem(const Scheduler& scheduler, std::unique_ptr<Defau ltFileSystemSync> syncImpl);
61 void Read(const std::string& path, 62 void Read(const std::string& path,
62 const ReadCallback& callback) const; 63 const ReadCallback& callback) const;
63 void Write(const std::string& path, 64 void Write(const std::string& path,
64 const IOBuffer& data, 65 const IOBuffer& data,
65 const Callback& callback); 66 const Callback& callback);
66 void Move(const std::string& fromPath, 67 void Move(const std::string& fromPath,
67 const std::string& toPath, 68 const std::string& toPath,
68 const Callback& callback); 69 const Callback& callback);
69 void Remove(const std::string& path, const Callback& callback); 70 void Remove(const std::string& path, const Callback& callback);
70 void Stat(const std::string& path, 71 void Stat(const std::string& path,
71 const StatCallback& callback) const; 72 const StatCallback& callback) const;
72 73
73 std::string Resolve(const std::string& path) const; 74 std::string Resolve(const std::string& path) const;
74 private: 75 private:
76 Scheduler scheduler;
75 std::unique_ptr<DefaultFileSystemSync> syncImpl; 77 std::unique_ptr<DefaultFileSystemSync> syncImpl;
76 }; 78 };
77 } 79 }
78 80
79 #endif 81 #endif
OLDNEW
« no previous file with comments | « include/AdblockPlus/JsEngine.h ('k') | src/DefaultFileSystem.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld