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

Side by Side Diff: third_party/WebKit/Source/core/timing/Performance.cpp

Issue 2478363003: PerformanceMonitor: do not leak performance objects through the monitor. (Closed)
Patch Set: rebaselined 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/timing/Performance.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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 if (!loader) 54 if (!loader)
55 return 0.0; 55 return 0.0;
56 56
57 return loader->timing().referenceMonotonicTime(); 57 return loader->timing().referenceMonotonicTime();
58 } 58 }
59 59
60 Performance::Performance(LocalFrame* frame) 60 Performance::Performance(LocalFrame* frame)
61 : PerformanceBase(toTimeOrigin(frame)), DOMWindowProperty(frame) {} 61 : PerformanceBase(toTimeOrigin(frame)), DOMWindowProperty(frame) {}
62 62
63 Performance::~Performance() { 63 Performance::~Performance() {
64 if (frame())
65 PerformanceMonitor::performanceObserverRemoved(this);
66 }
67
68 void Performance::frameDestroyed() {
64 PerformanceMonitor::performanceObserverRemoved(this); 69 PerformanceMonitor::performanceObserverRemoved(this);
70 DOMWindowProperty::frameDestroyed();
65 } 71 }
66 72
67 ExecutionContext* Performance::getExecutionContext() const { 73 ExecutionContext* Performance::getExecutionContext() const {
68 if (!frame()) 74 if (!frame())
69 return nullptr; 75 return nullptr;
70 return frame()->document(); 76 return frame()->document();
71 } 77 }
72 78
73 MemoryInfo* Performance::memory() { 79 MemoryInfo* Performance::memory() {
74 return MemoryInfo::create(); 80 return MemoryInfo::create();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 116 }
111 117
112 DEFINE_TRACE(Performance) { 118 DEFINE_TRACE(Performance) {
113 visitor->trace(m_navigation); 119 visitor->trace(m_navigation);
114 visitor->trace(m_timing); 120 visitor->trace(m_timing);
115 DOMWindowProperty::trace(visitor); 121 DOMWindowProperty::trace(visitor);
116 PerformanceBase::trace(visitor); 122 PerformanceBase::trace(visitor);
117 } 123 }
118 124
119 } // namespace blink 125 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/timing/Performance.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698