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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 | 45 |
46 // static | 46 // static |
47 MemoryCoordinator& MemoryCoordinator::Instance() { | 47 MemoryCoordinator& MemoryCoordinator::Instance() { |
48 DEFINE_STATIC_LOCAL(Persistent<MemoryCoordinator>, external, | 48 DEFINE_STATIC_LOCAL(Persistent<MemoryCoordinator>, external, |
49 (new MemoryCoordinator)); | 49 (new MemoryCoordinator)); |
50 DCHECK(IsMainThread()); | 50 DCHECK(IsMainThread()); |
51 return *external.Get(); | 51 return *external.Get(); |
52 } | 52 } |
53 | 53 |
54 | |
55 MemoryCoordinator::MemoryCoordinator() {} | 54 MemoryCoordinator::MemoryCoordinator() {} |
56 | 55 |
57 void MemoryCoordinator::RegisterClient(MemoryCoordinatorClient* client) { | 56 void MemoryCoordinator::RegisterClient(MemoryCoordinatorClient* client) { |
58 DCHECK(IsMainThread()); | 57 DCHECK(IsMainThread()); |
59 DCHECK(client); | 58 DCHECK(client); |
60 DCHECK(!clients_.Contains(client)); | 59 DCHECK(!clients_.Contains(client)); |
61 clients_.insert(client); | 60 clients_.insert(client); |
62 } | 61 } |
63 | 62 |
64 void MemoryCoordinator::UnregisterClient(MemoryCoordinatorClient* client) { | 63 void MemoryCoordinator::UnregisterClient(MemoryCoordinatorClient* client) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // MemoryCoordinatorClients rather than clearing caches here. | 96 // MemoryCoordinatorClients rather than clearing caches here. |
98 ImageDecodingStore::Instance().Clear(); | 97 ImageDecodingStore::Instance().Clear(); |
99 FontCache::GetFontCache()->Invalidate(); | 98 FontCache::GetFontCache()->Invalidate(); |
100 } | 99 } |
101 | 100 |
102 DEFINE_TRACE(MemoryCoordinator) { | 101 DEFINE_TRACE(MemoryCoordinator) { |
103 visitor->Trace(clients_); | 102 visitor->Trace(clients_); |
104 } | 103 } |
105 | 104 |
106 } // namespace blink | 105 } // namespace blink |
OLD | NEW |