OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "config.h" |
| 6 #include "core/frame/FrameProtector.h" |
| 7 |
| 8 #include "core/frame/Frame.h" |
| 9 #include "core/frame/FrameView.h" |
| 10 #include "core/frame/LocalFrame.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 |
| 15 FrameProtector::FrameProtector(PassRefPtrWillBeRawPtr<Frame> frame) |
| 16 : m_frame(frame) |
| 17 #if ENABLE(OILPAN) |
| 18 , m_isActive(m_frame && !m_frame->hasBeenDisposed()) |
| 19 #endif |
| 20 { |
| 21 #if ENABLE(OILPAN) |
| 22 if (m_isActive) |
| 23 m_frame->incrementDisposeProtectionCount(); |
| 24 #endif |
| 25 } |
| 26 |
| 27 FrameProtector::~FrameProtector() |
| 28 { |
| 29 #if ENABLE(OILPAN) |
| 30 if (willDispose()) |
| 31 m_frame->dispose(); |
| 32 #endif |
| 33 } |
| 34 |
| 35 bool FrameProtector::willDispose() const |
| 36 { |
| 37 #if ENABLE(OILPAN) |
| 38 return m_isActive && m_frame->decrementDisposeProtectionCount() == 0 && m_fr
ame->hasBeenDisposed(); |
| 39 #else |
| 40 return m_frame && m_frame->hasOneRef(); |
| 41 #endif |
| 42 } |
| 43 |
| 44 FrameViewProtector::FrameViewProtector(PassRefPtr<FrameView> frameView) |
| 45 : m_frameView(frameView) |
| 46 #if ENABLE(OILPAN) |
| 47 , m_frameProtector(m_frameView ? &m_frameView->frame() : nullptr) |
| 48 #endif |
| 49 { |
| 50 } |
| 51 |
| 52 bool FrameViewProtector::willDelete() const |
| 53 { |
| 54 return m_frameView && m_frameView->hasOneRef(); |
| 55 } |
| 56 |
| 57 FrameViewProtector::~FrameViewProtector() |
| 58 { |
| 59 } |
| 60 |
| 61 } // namespace blink |
OLD | NEW |