Index: components/resource_provider/resource_provider_impl.h |
diff --git a/components/resource_provider/resource_provider_impl.h b/components/resource_provider/resource_provider_impl.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3cfc12fd3c3e215f8504b629ba022d43fed2ecf2 |
--- /dev/null |
+++ b/components/resource_provider/resource_provider_impl.h |
@@ -0,0 +1,48 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef COMPONENTS_RESOURCE_PROVIDER_RESOURCE_PROVIDER_IMPL_H_ |
+#define COMPONENTS_RESOURCE_PROVIDER_RESOURCE_PROVIDER_IMPL_H_ |
+ |
+#include "base/files/file_path.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/weak_ptr.h" |
+#include "components/resource_provider/public/interfaces/resource_provider.mojom.h" |
+ |
+namespace base { |
+class SequencedWorkerPool; |
+} |
+ |
+namespace resource_provider { |
+ |
+// ResourceProvider implementation that loads resources in background threads. |
+class ResourceProviderImpl : public resource_provider::ResourceProvider { |
+ public: |
+ ResourceProviderImpl(const base::FilePath& application_path, |
+ base::SequencedWorkerPool* blocking_pool); |
+ ~ResourceProviderImpl() override; |
+ |
+ private: |
+ struct Data; |
+ |
+ static void ReadFileOnWorkerThread(const base::FilePath& path, |
+ scoped_refptr<Data> data); |
+ void OnReadFile(scoped_refptr<Data> data, |
+ const GetResourceCallback& callback); |
+ |
+ void GetResource(const mojo::String& path, |
+ const GetResourceCallback& callback) override; |
+ |
+ const base::FilePath application_path_; |
+ |
+ scoped_refptr<base::SequencedWorkerPool> blocking_pool_; |
+ |
+ base::WeakPtrFactory<ResourceProviderImpl> weak_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ResourceProviderImpl); |
+}; |
+ |
+} // namespace resource_provider |
+ |
+#endif // COMPONENTS_RESOURCE_PROVIDER_RESOURCE_PROVIDER_IMPL_H_ |