Index: content/browser/blob_storage/blob_dispatcher_host.h |
diff --git a/content/browser/blob_storage/blob_dispatcher_host.h b/content/browser/blob_storage/blob_dispatcher_host.h |
index aedf1438037a4b8444843f59d6723a0394de344b..a2d447ea10755ee922d85dc0cb14a65ff1150a7d 100644 |
--- a/content/browser/blob_storage/blob_dispatcher_host.h |
+++ b/content/browser/blob_storage/blob_dispatcher_host.h |
@@ -9,6 +9,7 @@ |
#include <string> |
#include <vector> |
+#include "base/callback_forward.h" |
#include "base/files/file.h" |
#include "base/gtest_prod_util.h" |
#include "base/macros.h" |
@@ -39,13 +40,19 @@ class ChromeBlobStorageContext; |
// This class's responsibility is to listen for and dispatch blob storage |
// messages and handle logistics of blob storage for a single child process. |
+// It also makes sure the renderer process sticks around while we transfer |
+// blobs. |
// When the child process terminates all blob references attributable to |
// that process go away upon destruction of the instance. |
// This lives in the browser process, is single threaded (IO thread), and there |
// is one per child process. |
class CONTENT_EXPORT BlobDispatcherHost : public BrowserMessageFilter { |
public: |
- explicit BlobDispatcherHost(ChromeBlobStorageContext* blob_storage_context); |
+ using SetSuddenTerminationAllowedCallback = base::Callback<void(bool)>; |
+ |
+ explicit BlobDispatcherHost( |
+ ChromeBlobStorageContext* blob_storage_context, |
+ SetSuddenTerminationAllowedCallback set_sudden_termination_allowed); |
// BrowserMessageFilter implementation. |
void OnChannelClosing() override; |
@@ -66,6 +73,7 @@ class CONTENT_EXPORT BlobDispatcherHost : public BrowserMessageFilter { |
friend class base::RefCountedThreadSafe<BlobDispatcherHost>; |
friend class BlobDispatcherHostTest; |
FRIEND_TEST_ALL_PREFIXES(BlobDispatcherHostTest, EmptyUUIDs); |
+ FRIEND_TEST_ALL_PREFIXES(BlobDispatcherHostTest, MultipleTransfers); |
FRIEND_TEST_ALL_PREFIXES(BlobDispatcherHostTest, SharedMemoryTransfer); |
FRIEND_TEST_ALL_PREFIXES(BlobDispatcherHostTest, OnCancelBuildingBlob); |
FRIEND_TEST_ALL_PREFIXES(BlobDispatcherHostTest, |
@@ -126,6 +134,12 @@ class CONTENT_EXPORT BlobDispatcherHost : public BrowserMessageFilter { |
// Unregisters all blobs and urls that were registered in this host. |
void ClearHostFromBlobStorageContext(); |
+ void AllowSuddenTerminationIfBuilderEmpty(); |
+ |
+ // Calling this should disable or enable sudden renderer termination. We use |
+ // this to keep the renderer alive while blobs are being transferred. |
+ SetSuddenTerminationAllowedCallback set_sudden_termination_allowed_; |
+ |
// Collection of blob ids and a count of how many usages |
// of that id are attributable to this consumer. |
BlobReferenceMap blobs_inuse_map_; |