Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(657)

Unified Diff: content/browser/indexed_db/database_factory_impl.h

Issue 1963293002: Replacing Indexed DB Chromium IPC with Mojo Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactoring after Passing URLRequestContextGetter. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/indexed_db/OWNERS ('k') | content/browser/indexed_db/database_factory_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/indexed_db/database_factory_impl.h
diff --git a/content/browser/indexed_db/database_factory_impl.h b/content/browser/indexed_db/database_factory_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..11c017b35b2d2dfb71fa38119631e01f7610fb8c
--- /dev/null
+++ b/content/browser/indexed_db/database_factory_impl.h
@@ -0,0 +1,92 @@
+// Copyright 2016 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 CONTENT_BROWSER_INDEXED_DB_DATABASE_FACTORY_IMPL_H_
+#define CONTENT_BROWSER_INDEXED_DB_DATABASE_FACTORY_IMPL_H_
+
+#include <memory>
+#include <set>
+#include <string>
+
+#include "Source/modules/indexeddb/indexed_db.mojom.h"
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
+#include "base/process/process_handle.h"
+#include "content/browser/bad_message.h"
+#include "content/public/browser/browser_context.h"
+#include "mojo/public/cpp/bindings/binding_set.h"
+
+namespace net {
+class URLRequestContextGetter;
+}
+
+namespace shell {
+class InterfaceRegistry;
+}
+
+namespace content {
+
+class IndexedDBConnection;
+class IndexedDBContextImpl;
+class IndexedDBDatabaseError;
+struct IndexedDBDatabaseMetadata;
+
+class DatabaseFactoryImpl : public ::indexed_db::mojom::DatabaseFactory,
+ public base::SupportsWeakPtr<DatabaseFactoryImpl> {
+ public:
+ // TODO(cmumford): Keep Create()?
+ static std::unique_ptr<DatabaseFactoryImpl> Create(
+ IndexedDBContextImpl* indexed_db_context,
+ net::URLRequestContextGetter* url_request_context_getter,
+ int render_process_host_id);
+ DatabaseFactoryImpl(IndexedDBContextImpl* indexed_db_context,
+ net::URLRequestContextGetter* url_request_context_getter,
+ int render_process_host_id);
+ ~DatabaseFactoryImpl() override;
+
+ void AddMojoService(shell::InterfaceRegistry* registry);
+ void Bind(::indexed_db::mojom::DatabaseFactoryRequest request);
+
+ private:
+ void CrashRendererAndClosePipe(bad_message::BadMessageReason reason);
+
+ RenderProcessHost* GetRenderProcessHost();
+
+ void OnOpenResult(const base::TimeTicks& begin_time,
+ const OpenCallback& mojo_callback,
+ std::unique_ptr<IndexedDBConnection> connection,
+ const IndexedDBDatabaseMetadata& metadata,
+ const IndexedDBDatabaseError& error);
+
+ // indexed_db::mojom::DatabaseFactory:
+ void GetDatabaseNames(const url::Origin& origin) override;
+
+ void Open(const std::string& name,
+ int64_t version,
+ int64_t transaction_id,
+ const url::Origin& origin,
+ ::indexed_db::mojom::OpenRequestObserverPtr open_observer,
+ ::indexed_db::mojom::DatabaseObserverPtr database_handler,
+ const OpenCallback& callback) override;
+
+ void DeleteDatabase(const std::string& name,
+ const url::Origin& origin) override;
+
+ void AddMojoServiceOnIDBThread(shell::InterfaceRegistry* registry);
+
+ // Used to set file permissions for blob storage.
+ int render_process_host_id_;
+ scoped_refptr<IndexedDBContextImpl> indexed_db_context_;
+ // Determine or document lifetime of getter.
+ net::URLRequestContextGetter* request_context_getter_;
+ std::set<std::unique_ptr<IndexedDBConnection>> connections_;
+ mojo::BindingSet<::indexed_db::mojom::DatabaseFactory> binding_;
+
+ DISALLOW_COPY_AND_ASSIGN(DatabaseFactoryImpl);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_INDEXED_DB_DATABASE_FACTORY_IMPL_H_
« no previous file with comments | « content/browser/indexed_db/OWNERS ('k') | content/browser/indexed_db/database_factory_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698