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

Unified Diff: components/discardable_memory/client/client_discardable_shared_memory_manager.h

Issue 2545523007: Revert of discardable_memory: Using mojo IPC to replace Chrome IPC (Closed)
Patch Set: 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: components/discardable_memory/client/client_discardable_shared_memory_manager.h
diff --git a/components/discardable_memory/client/client_discardable_shared_memory_manager.h b/components/discardable_memory/client/client_discardable_shared_memory_manager.h
index 93676a61701bac7378d11816bbbe509a09a15c3c..76215bc099f65ccd6cd36299f09ea531b29b1a4a 100644
--- a/components/discardable_memory/client/client_discardable_shared_memory_manager.h
+++ b/components/discardable_memory/client/client_discardable_shared_memory_manager.h
@@ -7,7 +7,6 @@
#include <stddef.h>
-#include "base/callback_helpers.h"
#include "base/macros.h"
#include "base/memory/discardable_memory_allocator.h"
#include "base/memory/ref_counted.h"
@@ -16,11 +15,7 @@
#include "base/trace_event/memory_dump_provider.h"
#include "components/discardable_memory/common/discardable_memory_export.h"
#include "components/discardable_memory/common/discardable_shared_memory_heap.h"
-#include "components/discardable_memory/public/interfaces/discardable_shared_memory_manager.mojom.h"
-
-namespace base {
-class SingleThreadTaskRunner;
-}
+#include "components/discardable_memory/common/discardable_shared_memory_id.h"
namespace discardable_memory {
@@ -30,9 +25,20 @@
: public base::DiscardableMemoryAllocator,
public base::trace_event::MemoryDumpProvider {
public:
- ClientDiscardableSharedMemoryManager(
- mojom::DiscardableSharedMemoryManagerPtr manager,
- scoped_refptr<base::SingleThreadTaskRunner> io_task_runner);
+ class Delegate {
+ public:
+ virtual void AllocateLockedDiscardableSharedMemory(
+ size_t size,
+ DiscardableSharedMemoryId id,
+ base::SharedMemoryHandle* handle) = 0;
+ virtual void DeletedDiscardableSharedMemory(
+ DiscardableSharedMemoryId id) = 0;
+
+ protected:
+ virtual ~Delegate() {}
+ };
+
+ explicit ClientDiscardableSharedMemoryManager(Delegate* delegate);
~ClientDiscardableSharedMemoryManager() override;
// Overridden from base::DiscardableMemoryAllocator:
@@ -64,25 +70,14 @@
private:
std::unique_ptr<base::DiscardableSharedMemory>
- AllocateLockedDiscardableSharedMemory(size_t size, int32_t id);
- void AllocateOnIO(size_t size,
- int32_t id,
- std::unique_ptr<base::DiscardableSharedMemory>* memory,
- base::ScopedClosureRunner closure_runner);
- void AllocateCompletedOnIO(
- std::unique_ptr<base::DiscardableSharedMemory>* memory,
- base::ScopedClosureRunner closure_runner,
- mojo::ScopedSharedBufferHandle mojo_handle);
-
- void DeletedDiscardableSharedMemory(int32_t id);
+ AllocateLockedDiscardableSharedMemory(size_t size,
+ DiscardableSharedMemoryId id);
void MemoryUsageChanged(size_t new_bytes_allocated,
size_t new_bytes_free) const;
- scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
- std::unique_ptr<mojom::DiscardableSharedMemoryManagerPtr> manager_mojo_;
-
mutable base::Lock lock_;
- std::unique_ptr<DiscardableSharedMemoryHeap> heap_;
+ DiscardableSharedMemoryHeap heap_;
+ Delegate* const delegate_;
DISALLOW_COPY_AND_ASSIGN(ClientDiscardableSharedMemoryManager);
};

Powered by Google App Engine
This is Rietveld 408576698