| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ |
| 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include <vector> | 10 #include <vector> |
| 9 | 11 |
| 12 #include "base/macros.h" |
| 10 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 13 #include "base/process/process.h" | 16 #include "base/process/process.h" |
| 14 #include "content/browser/appcache/appcache_backend_impl.h" | 17 #include "content/browser/appcache/appcache_backend_impl.h" |
| 15 #include "content/browser/appcache/appcache_frontend_proxy.h" | 18 #include "content/browser/appcache/appcache_frontend_proxy.h" |
| 16 #include "content/public/browser/browser_message_filter.h" | 19 #include "content/public/browser/browser_message_filter.h" |
| 17 | 20 |
| 18 namespace content { | 21 namespace content { |
| 19 class ChromeAppCacheService; | 22 class ChromeAppCacheService; |
| 20 | 23 |
| 21 // Handles appcache related messages sent to the main browser process from | 24 // Handles appcache related messages sent to the main browser process from |
| 22 // its child processes. There is a distinct host for each child process. | 25 // its child processes. There is a distinct host for each child process. |
| 23 // Messages are handled on the IO thread. The RenderProcessHostImpl creates | 26 // Messages are handled on the IO thread. The RenderProcessHostImpl creates |
| 24 // an instance and delegates calls to it. | 27 // an instance and delegates calls to it. |
| 25 class AppCacheDispatcherHost : public BrowserMessageFilter { | 28 class AppCacheDispatcherHost : public BrowserMessageFilter { |
| 26 public: | 29 public: |
| 27 AppCacheDispatcherHost(ChromeAppCacheService* appcache_service, | 30 AppCacheDispatcherHost(ChromeAppCacheService* appcache_service, |
| 28 int process_id); | 31 int process_id); |
| 29 | 32 |
| 30 // BrowserIOMessageFilter implementation | 33 // BrowserIOMessageFilter implementation |
| 31 void OnChannelConnected(int32 peer_pid) override; | 34 void OnChannelConnected(int32_t peer_pid) override; |
| 32 bool OnMessageReceived(const IPC::Message& message) override; | 35 bool OnMessageReceived(const IPC::Message& message) override; |
| 33 | 36 |
| 34 protected: | 37 protected: |
| 35 ~AppCacheDispatcherHost() override; | 38 ~AppCacheDispatcherHost() override; |
| 36 | 39 |
| 37 private: | 40 private: |
| 38 // IPC message handlers | 41 // IPC message handlers |
| 39 void OnRegisterHost(int host_id); | 42 void OnRegisterHost(int host_id); |
| 40 void OnUnregisterHost(int host_id); | 43 void OnUnregisterHost(int host_id); |
| 41 void OnSetSpawningHostId(int host_id, int spawning_host_id); | 44 void OnSetSpawningHostId(int host_id, int spawning_host_id); |
| 42 void OnSelectCache(int host_id, const GURL& document_url, | 45 void OnSelectCache(int host_id, |
| 43 int64 cache_document_was_loaded_from, | 46 const GURL& document_url, |
| 47 int64_t cache_document_was_loaded_from, |
| 44 const GURL& opt_manifest_url); | 48 const GURL& opt_manifest_url); |
| 45 void OnSelectCacheForWorker(int host_id, int parent_process_id, | 49 void OnSelectCacheForWorker(int host_id, int parent_process_id, |
| 46 int parent_host_id); | 50 int parent_host_id); |
| 47 void OnSelectCacheForSharedWorker(int host_id, int64 appcache_id); | 51 void OnSelectCacheForSharedWorker(int host_id, int64_t appcache_id); |
| 48 void OnMarkAsForeignEntry(int host_id, const GURL& document_url, | 52 void OnMarkAsForeignEntry(int host_id, |
| 49 int64 cache_document_was_loaded_from); | 53 const GURL& document_url, |
| 54 int64_t cache_document_was_loaded_from); |
| 50 void OnGetStatus(int host_id, IPC::Message* reply_msg); | 55 void OnGetStatus(int host_id, IPC::Message* reply_msg); |
| 51 void OnStartUpdate(int host_id, IPC::Message* reply_msg); | 56 void OnStartUpdate(int host_id, IPC::Message* reply_msg); |
| 52 void OnSwapCache(int host_id, IPC::Message* reply_msg); | 57 void OnSwapCache(int host_id, IPC::Message* reply_msg); |
| 53 void OnGetResourceList( | 58 void OnGetResourceList( |
| 54 int host_id, | 59 int host_id, |
| 55 std::vector<AppCacheResourceInfo>* resource_infos); | 60 std::vector<AppCacheResourceInfo>* resource_infos); |
| 56 void GetStatusCallback(AppCacheStatus status, void* param); | 61 void GetStatusCallback(AppCacheStatus status, void* param); |
| 57 void StartUpdateCallback(bool result, void* param); | 62 void StartUpdateCallback(bool result, void* param); |
| 58 void SwapCacheCallback(bool result, void* param); | 63 void SwapCacheCallback(bool result, void* param); |
| 59 | 64 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 71 int process_id_; | 76 int process_id_; |
| 72 | 77 |
| 73 base::WeakPtrFactory<AppCacheDispatcherHost> weak_factory_; | 78 base::WeakPtrFactory<AppCacheDispatcherHost> weak_factory_; |
| 74 | 79 |
| 75 DISALLOW_COPY_AND_ASSIGN(AppCacheDispatcherHost); | 80 DISALLOW_COPY_AND_ASSIGN(AppCacheDispatcherHost); |
| 76 }; | 81 }; |
| 77 | 82 |
| 78 } // namespace content | 83 } // namespace content |
| 79 | 84 |
| 80 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ | 85 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_DISPATCHER_HOST_H_ |
| OLD | NEW |