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

Side by Side Diff: third_party/WebKit/Source/core/css/MediaQueryEvaluator.cpp

Issue 1555993002: Reduce risk of MediaQueryEvaluator-induced leaks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
OLDNEW
1 /* 1 /*
2 * CSS Media Query Evaluator 2 * CSS Media Query Evaluator
3 * 3 *
4 * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>. 4 * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>.
5 * Copyright (C) 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2013 Intel Corporation. All rights reserved. 6 * Copyright (C) 2013 Intel Corporation. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 MediaQueryEvaluator::MediaQueryEvaluator(const MediaValues& mediaValues) 85 MediaQueryEvaluator::MediaQueryEvaluator(const MediaValues& mediaValues)
86 : m_expectedResult(false) // Doesn't matter when we have mediaValues. 86 : m_expectedResult(false) // Doesn't matter when we have mediaValues.
87 , m_mediaValues(mediaValues.copy()) 87 , m_mediaValues(mediaValues.copy())
88 { 88 {
89 } 89 }
90 90
91 MediaQueryEvaluator::~MediaQueryEvaluator() 91 MediaQueryEvaluator::~MediaQueryEvaluator()
92 { 92 {
93 } 93 }
94 94
95 DEFINE_TRACE(MediaQueryEvaluator)
96 {
97 visitor->trace(m_mediaValues);
98 }
99
95 const String MediaQueryEvaluator::mediaType() const 100 const String MediaQueryEvaluator::mediaType() const
96 { 101 {
97 // If a static mediaType was given by the constructor, we use it here. 102 // If a static mediaType was given by the constructor, we use it here.
98 if (!m_mediaType.isEmpty()) 103 if (!m_mediaType.isEmpty())
99 return m_mediaType; 104 return m_mediaType;
100 // Otherwise, we get one from mediaValues (which may be dynamic or cached). 105 // Otherwise, we get one from mediaValues (which may be dynamic or cached).
101 if (m_mediaValues) 106 if (m_mediaValues)
102 return m_mediaValues->mediaType(); 107 return m_mediaValues->mediaType();
103 return nullAtom; 108 return nullAtom;
104 } 109 }
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 // Call the media feature evaluation function. Assume no prefix and let 663 // Call the media feature evaluation function. Assume no prefix and let
659 // trampoline functions override the prefix if prefix is used. 664 // trampoline functions override the prefix if prefix is used.
660 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl()); 665 EvalFunc func = gFunctionMap->get(expr->mediaFeature().impl());
661 if (func) 666 if (func)
662 return func(expr->expValue(), NoPrefix, *m_mediaValues); 667 return func(expr->expValue(), NoPrefix, *m_mediaValues);
663 668
664 return false; 669 return false;
665 } 670 }
666 671
667 } // namespace 672 } // namespace
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/MediaQueryEvaluator.h ('k') | third_party/WebKit/Source/core/css/MediaQueryMatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698