OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "platform/MemoryCoordinator.h" | 5 #include "platform/MemoryCoordinator.h" |
6 | 6 |
7 #include "base/sys_info.h" | 7 #include "base/sys_info.h" |
8 #include "platform/fonts/FontCache.h" | 8 #include "platform/fonts/FontCache.h" |
9 #include "platform/graphics/ImageDecodingStore.h" | 9 #include "platform/graphics/ImageDecodingStore.h" |
10 #include "platform/instrumentation/tracing/TraceEvent.h" | 10 #include "platform/instrumentation/tracing/TraceEvent.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 } | 31 } |
32 | 32 |
33 // static | 33 // static |
34 MemoryCoordinator& MemoryCoordinator::instance() { | 34 MemoryCoordinator& MemoryCoordinator::instance() { |
35 DEFINE_STATIC_LOCAL(Persistent<MemoryCoordinator>, external, | 35 DEFINE_STATIC_LOCAL(Persistent<MemoryCoordinator>, external, |
36 (new MemoryCoordinator)); | 36 (new MemoryCoordinator)); |
37 DCHECK(isMainThread()); | 37 DCHECK(isMainThread()); |
38 return *external.get(); | 38 return *external.get(); |
39 } | 39 } |
40 | 40 |
41 | |
42 MemoryCoordinator::MemoryCoordinator() {} | 41 MemoryCoordinator::MemoryCoordinator() {} |
43 | 42 |
44 void MemoryCoordinator::registerClient(MemoryCoordinatorClient* client) { | 43 void MemoryCoordinator::registerClient(MemoryCoordinatorClient* client) { |
45 DCHECK(isMainThread()); | 44 DCHECK(isMainThread()); |
46 DCHECK(client); | 45 DCHECK(client); |
47 DCHECK(!m_clients.contains(client)); | 46 DCHECK(!m_clients.contains(client)); |
48 m_clients.insert(client); | 47 m_clients.insert(client); |
49 } | 48 } |
50 | 49 |
51 void MemoryCoordinator::unregisterClient(MemoryCoordinatorClient* client) { | 50 void MemoryCoordinator::unregisterClient(MemoryCoordinatorClient* client) { |
(...skipping 30 matching lines...) Expand all Loading... |
82 // MemoryCoordinatorClients rather than clearing caches here. | 81 // MemoryCoordinatorClients rather than clearing caches here. |
83 ImageDecodingStore::instance().clear(); | 82 ImageDecodingStore::instance().clear(); |
84 FontCache::fontCache()->invalidate(); | 83 FontCache::fontCache()->invalidate(); |
85 } | 84 } |
86 | 85 |
87 DEFINE_TRACE(MemoryCoordinator) { | 86 DEFINE_TRACE(MemoryCoordinator) { |
88 visitor->trace(m_clients); | 87 visitor->trace(m_clients); |
89 } | 88 } |
90 | 89 |
91 } // namespace blink | 90 } // namespace blink |
OLD | NEW |