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

Unified Diff: components/discardable_memory/common/discardable_shared_memory_manager.h

Issue 2459733002: Move discardable memory to //components from //content (Closed)
Patch Set: Fix build error 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/common/discardable_shared_memory_manager.h
diff --git a/content/common/host_discardable_shared_memory_manager.h b/components/discardable_memory/common/discardable_shared_memory_manager.h
similarity index 84%
rename from content/common/host_discardable_shared_memory_manager.h
rename to components/discardable_memory/common/discardable_shared_memory_manager.h
index 59a939a0297718df1f44cc4455fd68a962016a4d..76461af9feb9cf8909c37d8d2d8468c9ab5454a0 100644
--- a/content/common/host_discardable_shared_memory_manager.h
+++ b/components/discardable_memory/common/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_COMMON_HOST_DISCARDABLE_SHARED_MEMORY_MANAGER_H_
-#define CONTENT_COMMON_HOST_DISCARDABLE_SHARED_MEMORY_MANAGER_H_
+#ifndef COMPONENTS_DISCARDABLE_MEMORY_COMMON_HOST_DISCARDABLE_SHARED_MEMORY_MANAGER_H_
reveman 2016/11/01 17:18:39 remove HOST_
Peng 2016/11/01 18:38:30 Done.
+#define COMPONENTS_DISCARDABLE_MEMORY_COMMON_HOST_DISCARDABLE_SHARED_MEMORY_MANAGER_H_
reveman 2016/11/01 17:18:39 remove HOST_
Peng 2016/11/01 18:38:30 Done.
#include <stddef.h>
#include <stdint.h>
@@ -26,24 +26,26 @@
#include "base/synchronization/lock.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/memory_dump_provider.h"
-#include "content/common/content_export.h"
+#include "components/discardable_memory/common/discardable_memory_export.h"
-namespace content {
+namespace discardable_memory {
typedef int32_t DiscardableSharedMemoryId;
// Implementation of DiscardableMemoryAllocator that allocates and manages
-// discardable memory segments for the browser process and child processes.
+// discardable memory segments for the process which hosts this class, and
+// for remote processes which request discardable memory from this class via
+// IPC.
// This class is thread-safe and instances can safely be used on any thread.
-class CONTENT_EXPORT HostDiscardableSharedMemoryManager
+class DISCARDABLE_MEMORY_EXPORT DiscardableSharedMemoryManager
: public base::DiscardableMemoryAllocator,
public base::trace_event::MemoryDumpProvider,
public base::MemoryCoordinatorClient {
public:
- HostDiscardableSharedMemoryManager();
- ~HostDiscardableSharedMemoryManager() override;
+ DiscardableSharedMemoryManager();
+ ~DiscardableSharedMemoryManager() override;
// Returns a singleton instance.
- static HostDiscardableSharedMemoryManager* current();
+ static DiscardableSharedMemoryManager* current();
// Overridden from base::DiscardableMemoryAllocator:
std::unique_ptr<base::DiscardableMemory> AllocateLockedDiscardableMemory(
@@ -129,7 +131,8 @@ class CONTENT_EXPORT HostDiscardableSharedMemoryManager
base::Lock lock_;
typedef base::hash_map<DiscardableSharedMemoryId,
- scoped_refptr<MemorySegment>> MemorySegmentMap;
+ scoped_refptr<MemorySegment>>
+ MemorySegmentMap;
typedef base::hash_map<int, MemorySegmentMap> ProcessMap;
ProcessMap processes_;
// Note: The elements in |segments_| are arranged in such a way that they form
@@ -144,11 +147,11 @@ class CONTENT_EXPORT HostDiscardableSharedMemoryManager
enforce_memory_policy_task_runner_;
base::Closure enforce_memory_policy_callback_;
bool enforce_memory_policy_pending_;
- base::WeakPtrFactory<HostDiscardableSharedMemoryManager> weak_ptr_factory_;
+ base::WeakPtrFactory<DiscardableSharedMemoryManager> weak_ptr_factory_;
- DISALLOW_COPY_AND_ASSIGN(HostDiscardableSharedMemoryManager);
+ DISALLOW_COPY_AND_ASSIGN(DiscardableSharedMemoryManager);
};
-} // namespace content
+} // namespace discardable_memory
-#endif // CONTENT_COMMON_HOST_DISCARDABLE_SHARED_MEMORY_MANAGER_H_
+#endif // COMPONENTS_DISCARDABLE_MEMORY_COMMON_HOST_DISCARDABLE_SHARED_MEMORY_MANAGER_H_
reveman 2016/11/01 17:18:39 remove HOST_
Peng 2016/11/01 18:38:30 Done.

Powered by Google App Engine
This is Rietveld 408576698