1/* 2 * Copyright (C) 2009, 2010, 2013 Apple Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25 26#ifndef CachedFrame_h 27#define CachedFrame_h 28 29#include "DOMWindow.h" 30#include "URL.h" 31#include "ScriptCachedFrameData.h" 32#include <wtf/RefPtr.h> 33 34namespace WebCore { 35 36class CachedFrame; 37class CachedFramePlatformData; 38class Document; 39class DocumentLoader; 40class FrameView; 41class Node; 42 43class CachedFrameBase { 44public: 45 void restore(); 46 47 Document* document() const { return m_document.get(); } 48 FrameView* view() const { return m_view.get(); } 49 const URL& url() const { return m_url; } 50 bool isMainFrame() { return m_isMainFrame; } 51 52protected: 53 CachedFrameBase(Frame&); 54 ~CachedFrameBase(); 55 56 RefPtr<Document> m_document; 57 RefPtr<DocumentLoader> m_documentLoader; 58 RefPtr<FrameView> m_view; 59 URL m_url; 60 std::unique_ptr<ScriptCachedFrameData> m_cachedFrameScriptData; 61 std::unique_ptr<CachedFramePlatformData> m_cachedFramePlatformData; 62 bool m_isMainFrame; 63 bool m_isComposited; 64 65 Vector<std::unique_ptr<CachedFrame>> m_childFrames; 66}; 67 68class CachedFrame : private CachedFrameBase { 69public: 70 explicit CachedFrame(Frame&); 71 72 void open(); 73 void clear(); 74 void destroy(); 75 76 void setCachedFramePlatformData(std::unique_ptr<CachedFramePlatformData>); 77 CachedFramePlatformData* cachedFramePlatformData(); 78 79 using CachedFrameBase::document; 80 using CachedFrameBase::view; 81 using CachedFrameBase::url; 82 DocumentLoader* documentLoader() const { return m_documentLoader.get(); } 83 84 int descendantFrameCount() const; 85}; 86 87} // namespace WebCore 88 89#endif // CachedFrame_h 90