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

Side by Side Diff: Source/core/timing/ConsoleMemory.cpp

Issue 1230203003: Don't cache MemoryInfo instance on ConsoleMemory object. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: update corresponding console.memory layout test Created 5 years, 5 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/timing/ConsoleMemory.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "config.h" 5 #include "config.h"
6 #include "core/timing/ConsoleMemory.h" 6 #include "core/timing/ConsoleMemory.h"
7 7
8 #include "core/frame/Console.h" 8 #include "core/frame/Console.h"
9 #include "core/timing/MemoryInfo.h" 9 #include "core/timing/MemoryInfo.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 DEFINE_TRACE(ConsoleMemory)
14 {
15 visitor->trace(m_memory);
16 HeapSupplement<Console>::trace(visitor);
17 }
18
19 // static 13 // static
20 ConsoleMemory& ConsoleMemory::from(Console& console) 14 ConsoleMemory& ConsoleMemory::from(Console& console)
21 { 15 {
22 ConsoleMemory* supplement = static_cast<ConsoleMemory*>(HeapSupplement<Conso le>::from(console, supplementName())); 16 ConsoleMemory* supplement = static_cast<ConsoleMemory*>(HeapSupplement<Conso le>::from(console, supplementName()));
23 if (!supplement) { 17 if (!supplement) {
24 supplement = new ConsoleMemory(); 18 supplement = new ConsoleMemory();
25 provideTo(console, supplementName(), supplement); 19 provideTo(console, supplementName(), supplement);
26 } 20 }
27 return *supplement; 21 return *supplement;
28 } 22 }
29 23
30 // static 24 // static
31 MemoryInfo* ConsoleMemory::memory(Console& console) 25 MemoryInfo* ConsoleMemory::memory(Console& console)
32 { 26 {
33 return ConsoleMemory::from(console).memory(); 27 return ConsoleMemory::from(console).memory();
34 } 28 }
35 29
36 MemoryInfo* ConsoleMemory::memory() 30 MemoryInfo* ConsoleMemory::memory()
37 { 31 {
38 if (!m_memory) 32 return MemoryInfo::create();
39 m_memory = MemoryInfo::create();
40
41 return m_memory.get();
42 } 33 }
43 34
44 } // namespace blink 35 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/timing/ConsoleMemory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698