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

Unified Diff: Source/core/frame/FrameProtector.cpp

Issue 517043003: Move Frame to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase past r181245 conflict Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/frame/FrameProtector.cpp
diff --git a/Source/core/frame/FrameProtector.cpp b/Source/core/frame/FrameProtector.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..c7ffc5f80e89784820829b86c38ed214d7ea5174
--- /dev/null
+++ b/Source/core/frame/FrameProtector.cpp
@@ -0,0 +1,61 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/frame/FrameProtector.h"
+
+#include "core/frame/Frame.h"
+#include "core/frame/FrameView.h"
+#include "core/frame/LocalFrame.h"
+
+namespace blink {
+
+
+FrameProtector::FrameProtector(PassRefPtrWillBeRawPtr<Frame> frame)
+ : m_frame(frame)
+#if ENABLE(OILPAN)
+ , m_isActive(m_frame && !m_frame->hasBeenDisposed())
+#endif
+{
+#if ENABLE(OILPAN)
+ if (m_isActive)
+ m_frame->incrementDisposeProtectionCount();
+#endif
+}
+
+FrameProtector::~FrameProtector()
+{
+#if ENABLE(OILPAN)
+ if (willDispose())
+ m_frame->dispose();
+#endif
+}
+
+bool FrameProtector::willDispose() const
+{
+#if ENABLE(OILPAN)
+ return m_isActive && m_frame->decrementDisposeProtectionCount() == 0 && m_frame->hasBeenDisposed();
+#else
+ return m_frame && m_frame->hasOneRef();
+#endif
+}
+
+FrameViewProtector::FrameViewProtector(PassRefPtr<FrameView> frameView)
+ : m_frameView(frameView)
+#if ENABLE(OILPAN)
+ , m_frameProtector(m_frameView ? &m_frameView->frame() : nullptr)
+#endif
+{
+}
+
+bool FrameViewProtector::willDelete() const
+{
+ return m_frameView && m_frameView->hasOneRef();
+}
+
+FrameViewProtector::~FrameViewProtector()
+{
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698