Chromium Code Reviews| Index: chrome/browser/chromeos/file_system_provider/request_manager.h |
| diff --git a/chrome/browser/chromeos/file_system_provider/request_manager.h b/chrome/browser/chromeos/file_system_provider/request_manager.h |
| index 4b2d1da445dd984da352ec81dcecf36af36217c1..a1e1f9d473ff73e54bfa293245a52f0c647ba003 100644 |
| --- a/chrome/browser/chromeos/file_system_provider/request_manager.h |
| +++ b/chrome/browser/chromeos/file_system_provider/request_manager.h |
| @@ -11,6 +11,8 @@ |
| #include "base/callback.h" |
| #include "base/files/file.h" |
| #include "base/memory/scoped_ptr.h" |
| +#include "base/memory/scoped_ptr.h" |
|
hashimoto
2014/04/18 05:28:09
nit: This line is duplicated.
mtomasz
2014/04/18 05:56:18
Done.
|
| +#include "base/timer/timer.h" |
| #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h" |
| namespace base { |
| @@ -47,22 +49,36 @@ class RequestManager { |
| // returns false. Always disposes the request. |
| bool RejectRequest(int request_id, base::File::Error error); |
| + // Sets a custom timeout in milliseconds for tests. The new timeout value will |
| + // be applied to new requests |
| + void SetTimeoutForTests(int timeout); |
| + |
| private: |
| struct Request { |
| Request(); |
| ~Request(); |
| + // Timer for discarding the request during a timeout. |
| + base::OneShotTimer<RequestManager> timeout_timer; |
| + |
| // Callback to be called on success. |
| SuccessCallback success_callback; |
| // Callback to be called on error. |
| ErrorCallback error_callback; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(Request); |
| }; |
| - typedef std::map<int, Request> RequestMap; |
| + typedef std::map<int, Request*> RequestMap; |
| + |
| + // Called when a request with |request_id| timeouts. |
| + void OnRequestTimeout(int request_id); |
| RequestMap requests_; |
| int next_id_; |
| + int timeout_; |
|
hashimoto
2014/04/18 05:28:09
Why don't you use base::TimeDelta which takes care
mtomasz
2014/04/18 05:56:18
Done.
|
| DISALLOW_COPY_AND_ASSIGN(RequestManager); |
| }; |