| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #include "wtf/text/AtomicString.h" | 38 #include "wtf/text/AtomicString.h" |
| 39 #include <memory> | 39 #include <memory> |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 class BrowserControls; | 43 class BrowserControls; |
| 44 class ConsoleMessageStorage; | 44 class ConsoleMessageStorage; |
| 45 class OverscrollController; | 45 class OverscrollController; |
| 46 class Page; | 46 class Page; |
| 47 class TopDocumentRootScrollerController; | 47 class TopDocumentRootScrollerController; |
| 48 class VisualViewport; | |
| 49 | 48 |
| 50 // FrameHost is the set of global data shared between multiple frames | 49 // FrameHost is the set of global data shared between multiple frames |
| 51 // and is provided by the embedder to each frame when created. | 50 // and is provided by the embedder to each frame when created. |
| 52 // FrameHost currently corresponds to the Page object in core/page | 51 // FrameHost currently corresponds to the Page object in core/page |
| 53 // however the concept of a Page is moving up out of Blink. | 52 // however the concept of a Page is moving up out of Blink. |
| 54 // In an out-of-process iframe world, a single Page may have | 53 // In an out-of-process iframe world, a single Page may have |
| 55 // multiple frames in different process, thus Page becomes a | 54 // multiple frames in different process, thus Page becomes a |
| 56 // browser-level concept and Blink core/ only knows about its LocalFrame (and | 55 // browser-level concept and Blink core/ only knows about its LocalFrame (and |
| 57 // FrameHost). Separating Page from the rest of core/ through this indirection | 56 // FrameHost). Separating Page from the rest of core/ through this indirection |
| 58 // allows us to slowly refactor Page without breaking the rest of core. | 57 // allows us to slowly refactor Page without breaking the rest of core. |
| 59 // TODO(sashab): Merge FrameHost back into Page. crbug.com/688614 | 58 // TODO(sashab): Merge FrameHost back into Page. crbug.com/688614 |
| 60 class CORE_EXPORT FrameHost final | 59 class CORE_EXPORT FrameHost final |
| 61 : public GarbageCollectedFinalized<FrameHost> { | 60 : public GarbageCollectedFinalized<FrameHost> { |
| 62 WTF_MAKE_NONCOPYABLE(FrameHost); | 61 WTF_MAKE_NONCOPYABLE(FrameHost); |
| 63 | 62 |
| 64 public: | 63 public: |
| 65 static FrameHost* create(Page&); | 64 static FrameHost* create(Page&); |
| 66 ~FrameHost(); | 65 ~FrameHost(); |
| 67 | 66 |
| 68 Page& page(); | 67 Page& page(); |
| 69 const Page& page() const; | 68 const Page& page() const; |
| 70 | 69 |
| 71 BrowserControls& browserControls(); | 70 BrowserControls& browserControls(); |
| 72 const BrowserControls& browserControls() const; | 71 const BrowserControls& browserControls() const; |
| 73 | 72 |
| 74 OverscrollController& overscrollController(); | 73 OverscrollController& overscrollController(); |
| 75 const OverscrollController& overscrollController() const; | 74 const OverscrollController& overscrollController() const; |
| 76 | 75 |
| 77 VisualViewport& visualViewport(); | |
| 78 const VisualViewport& visualViewport() const; | |
| 79 | |
| 80 ConsoleMessageStorage& consoleMessageStorage(); | 76 ConsoleMessageStorage& consoleMessageStorage(); |
| 81 const ConsoleMessageStorage& consoleMessageStorage() const; | 77 const ConsoleMessageStorage& consoleMessageStorage() const; |
| 82 | 78 |
| 83 TopDocumentRootScrollerController& globalRootScrollerController() const; | 79 TopDocumentRootScrollerController& globalRootScrollerController() const; |
| 84 | 80 |
| 85 DECLARE_TRACE(); | 81 DECLARE_TRACE(); |
| 86 | 82 |
| 87 // Don't allow more than a certain number of frames in a page. | 83 // Don't allow more than a certain number of frames in a page. |
| 88 // This seems like a reasonable upper bound, and otherwise mutually | 84 // This seems like a reasonable upper bound, and otherwise mutually |
| 89 // recursive frameset pages can quickly bring the program to its knees | 85 // recursive frameset pages can quickly bring the program to its knees |
| 90 // with exponential growth in the number of frames. | 86 // with exponential growth in the number of frames. |
| 91 static const int maxNumberOfFrames = 1000; | 87 static const int maxNumberOfFrames = 1000; |
| 92 void incrementSubframeCount() { ++m_subframeCount; } | 88 void incrementSubframeCount() { ++m_subframeCount; } |
| 93 void decrementSubframeCount() { | 89 void decrementSubframeCount() { |
| 94 ASSERT(m_subframeCount); | 90 ASSERT(m_subframeCount); |
| 95 --m_subframeCount; | 91 --m_subframeCount; |
| 96 } | 92 } |
| 97 int subframeCount() const; | 93 int subframeCount() const; |
| 98 | 94 |
| 99 private: | 95 private: |
| 100 explicit FrameHost(Page&); | 96 explicit FrameHost(Page&); |
| 101 | 97 |
| 102 const Member<Page> m_page; | 98 const Member<Page> m_page; |
| 103 const Member<VisualViewport> m_visualViewport; | |
| 104 const Member<OverscrollController> m_overscrollController; | 99 const Member<OverscrollController> m_overscrollController; |
| 105 const Member<ConsoleMessageStorage> m_consoleMessageStorage; | 100 const Member<ConsoleMessageStorage> m_consoleMessageStorage; |
| 106 const Member<TopDocumentRootScrollerController> | 101 const Member<TopDocumentRootScrollerController> |
| 107 m_globalRootScrollerController; | 102 m_globalRootScrollerController; |
| 108 | 103 |
| 109 int m_subframeCount; | 104 int m_subframeCount; |
| 110 }; | 105 }; |
| 111 | 106 |
| 112 } // namespace blink | 107 } // namespace blink |
| 113 | 108 |
| 114 #endif // FrameHost_h | 109 #endif // FrameHost_h |
| OLD | NEW |