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

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

Issue 2459733002: Move discardable memory to //components from //content (Closed)
Patch Set: Fix build error in ios Created 4 years, 1 month 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/child_discardable_shared_memory_manager.h
diff --git a/content/child/child_discardable_shared_memory_manager.h b/components/discardable_memory/client/child_discardable_shared_memory_manager.h
similarity index 66%
rename from content/child/child_discardable_shared_memory_manager.h
rename to components/discardable_memory/client/child_discardable_shared_memory_manager.h
index 9f83e1c19c887104db28e793d1263da9f7431e42..b23f6b33045bec4c0c24b3b5bc07f72337628f7d 100644
--- a/content/child/child_discardable_shared_memory_manager.h
+++ b/components/discardable_memory/client/child_discardable_shared_memory_manager.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_CHILD_CHILD_DISCARDABLE_SHARED_MEMORY_MANAGER_H_
-#define CONTENT_CHILD_CHILD_DISCARDABLE_SHARED_MEMORY_MANAGER_H_
+#ifndef COMPONENTS_DISCARDABLE_MEMORY_CLIENT_CHILD_DISCARDABLE_SHARED_MEMORY_MANAGER_H_
+#define COMPONENTS_DISCARDABLE_MEMORY_CLIENT_CHILD_DISCARDABLE_SHARED_MEMORY_MANAGER_H_
#include <stddef.h>
@@ -12,20 +12,30 @@
#include "base/memory/ref_counted.h"
#include "base/synchronization/lock.h"
#include "base/trace_event/memory_dump_provider.h"
-#include "content/child/thread_safe_sender.h"
-#include "content/common/content_export.h"
-#include "content/common/discardable_shared_memory_heap.h"
-#include "content/common/host_discardable_shared_memory_manager.h"
+#include "components/discardable_memory/common/discardable_memory_export.h"
+#include "components/discardable_memory/common/discardable_shared_memory_heap.h"
+#include "components/discardable_memory/common/discardable_shared_memory_manager.h"
-namespace content {
+namespace discardable_memory {
// Implementation of DiscardableMemoryAllocator that allocates
// discardable memory segments through the browser process.
-class CONTENT_EXPORT ChildDiscardableSharedMemoryManager
+class DISCARDABLE_MEMORY_EXPORT ChildDiscardableSharedMemoryManager
: public base::DiscardableMemoryAllocator,
public base::trace_event::MemoryDumpProvider {
public:
- explicit ChildDiscardableSharedMemoryManager(ThreadSafeSender* sender);
+ class Delegate {
+ public:
+ virtual ~Delegate() {}
reveman 2016/10/31 22:46:02 nit: can this be protected?
Peng 2016/11/01 14:26:18 Done.
+ virtual void AllocateLockedDiscardableSharedMemory(
+ size_t size,
+ DiscardableSharedMemoryId id,
+ base::SharedMemoryHandle* handle) = 0;
+ virtual void DeletedDiscardableSharedMemory(
+ DiscardableSharedMemoryId id) = 0;
+ };
+
+ explicit ChildDiscardableSharedMemoryManager(Delegate* delegate);
~ChildDiscardableSharedMemoryManager() override;
// Overridden from base::DiscardableMemoryAllocator:
@@ -64,11 +74,11 @@ class CONTENT_EXPORT ChildDiscardableSharedMemoryManager
mutable base::Lock lock_;
DiscardableSharedMemoryHeap heap_;
- scoped_refptr<ThreadSafeSender> sender_;
+ Delegate* delegate_;
reveman 2016/10/31 22:46:02 nit: Delegate* const delegate_
Peng 2016/11/01 14:26:18 Done.
DISALLOW_COPY_AND_ASSIGN(ChildDiscardableSharedMemoryManager);
};
-} // namespace content
+} // namespace discardable_memory
-#endif // CONTENT_CHILD_CHILD_DISCARDABLE_SHARED_MEMORY_MANAGER_H_
+#endif // COMPONENTS_DISCARDABLE_MEMORY_CLIENT_CHILD_DISCARDABLE_SHARED_MEMORY_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698