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

Unified Diff: content/browser/appcache/appcache_navigation_handle_core.h

Issue 2501343003: PlzNavigate: AppCache support. (Closed)
Patch Set: Address review comments Created 4 years 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
Index: content/browser/appcache/appcache_navigation_handle_core.h
diff --git a/content/browser/appcache/appcache_navigation_handle_core.h b/content/browser/appcache/appcache_navigation_handle_core.h
new file mode 100644
index 0000000000000000000000000000000000000000..fa9497a7884e1612f48167ac6722d8fffb525750
--- /dev/null
+++ b/content/browser/appcache/appcache_navigation_handle_core.h
@@ -0,0 +1,80 @@
+// 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_APPCACHE_APPCACHE_NAVIGATION_HANDLE_CORE_H_
+#define CONTENT_BROWSER_APPCACHE_APPCACHE_NAVIGATION_HANDLE_CORE_H_
+
+#include <memory>
+
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
+#include "content/common/appcache_interfaces.h"
+
+namespace content {
+
+class AppCacheNavigationHandle;
+class AppCacheHost;
+class AppCacheServiceImpl;
+class ChromeAppCacheService;
+
+// PlzNavigate
+// This class is used to manage the lifetime of AppCacheHosts
+// created during navigations. This class is created on the UI thread, but
+// should only be accessed from the IO thread afterwards. It is the IO thread
+// pendant of AppCacheNavigationHandle. See the
+// AppCacheNavigationHandle header for more details about the lifetime of
+// both classes.
+class AppCacheNavigationHandleCore : public AppCacheFrontend {
+ public:
+ AppCacheNavigationHandleCore(
+ base::WeakPtr<AppCacheNavigationHandle> ui_handle,
+ ChromeAppCacheService* appcache_service,
+ int appcache_host_id);
+ ~AppCacheNavigationHandleCore() override;
+
+ // Returns the raw AppCacheHost pointer. Ownership remains with this class.
+ AppCacheHost* host() { return precreated_host_.get(); }
+
+ // Initializes this instance. Should be called on the IO thread.
+ void Initialize();
+
+ // Returns the precreated AppCacheHost pointer. Ownership of the host is
+ // released here.
+ static std::unique_ptr<AppCacheHost> GetPrecreatedHost(int host_id);
+
+ AppCacheServiceImpl* GetAppCacheService();
+
+ protected:
+ // AppCacheFrontend methods
+ // We don't expect calls on the AppCacheFrontend methods while the
+ // AppCacheHost is not registered with the AppCacheBackend.
+ void OnCacheSelected(int host_id, const AppCacheInfo& info) override;
+ void OnStatusChanged(const std::vector<int>& host_ids,
+ AppCacheStatus status) override;
+ void OnEventRaised(const std::vector<int>& host_ids,
+ AppCacheEventID event_id) override;
+ void OnProgressEventRaised(const std::vector<int>& host_ids,
+ const GURL& url,
+ int num_total,
+ int num_complete) override;
+ void OnErrorEventRaised(const std::vector<int>& host_ids,
+ const AppCacheErrorDetails& details) override;
+ void OnLogMessage(int host_id,
+ AppCacheLogLevel log_level,
+ const std::string& message) override;
+ void OnContentBlocked(int host_id, const GURL& manifest_url) override;
+
+ private:
+ std::unique_ptr<AppCacheHost> precreated_host_;
+ scoped_refptr<ChromeAppCacheService> appcache_service_;
+ int appcache_host_id_;
+ base::WeakPtr<AppCacheNavigationHandle> ui_handle_;
+
+ DISALLOW_COPY_AND_ASSIGN(AppCacheNavigationHandleCore);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_APPCACHE_APPCACHE_NAVIGATION_HANDLE_CORE_H_
« no previous file with comments | « content/browser/appcache/appcache_navigation_handle.cc ('k') | content/browser/appcache/appcache_navigation_handle_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698