OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 #include "wtf/MainThread.h" | 110 #include "wtf/MainThread.h" |
111 #include "wtf/MathExtras.h" | 111 #include "wtf/MathExtras.h" |
112 #include "wtf/text/WTFString.h" | 112 #include "wtf/text/WTFString.h" |
113 #include <algorithm> | 113 #include <algorithm> |
114 | 114 |
115 using std::min; | 115 using std::min; |
116 using std::max; | 116 using std::max; |
117 | 117 |
118 namespace blink { | 118 namespace blink { |
119 | 119 |
120 LocalDOMWindow::WindowFrameObserver::WindowFrameObserver( | 120 LocalDOMWindow::WindowFrameObserver::WindowFrameObserver(LocalDOMWindow* window,
LocalFrame& frame) |
121 LocalDOMWindow& window, LocalFrame& frame) | |
122 : FrameDestructionObserver(&frame) | 121 : FrameDestructionObserver(&frame) |
123 , m_window(window) | 122 , m_window(window) |
124 { | 123 { |
125 } | 124 } |
126 | 125 |
| 126 PassOwnPtrWillBeRawPtr<LocalDOMWindow::WindowFrameObserver> LocalDOMWindow::Wind
owFrameObserver::create(LocalDOMWindow* window, LocalFrame& frame) |
| 127 { |
| 128 return adoptPtrWillBeNoop(new WindowFrameObserver(window, frame)); |
| 129 } |
| 130 |
| 131 #if !ENABLE(OILPAN) |
| 132 LocalDOMWindow::WindowFrameObserver::~WindowFrameObserver() |
| 133 { |
| 134 } |
| 135 #endif |
| 136 |
| 137 void LocalDOMWindow::WindowFrameObserver::trace(Visitor* visitor) |
| 138 { |
| 139 visitor->trace(m_window); |
| 140 FrameDestructionObserver::trace(visitor); |
| 141 } |
| 142 |
127 void LocalDOMWindow::WindowFrameObserver::willDetachFrameHost() | 143 void LocalDOMWindow::WindowFrameObserver::willDetachFrameHost() |
128 { | 144 { |
129 m_window.willDetachFrameHost(); | 145 m_window->willDetachFrameHost(); |
130 } | 146 } |
131 | 147 |
132 class PostMessageTimer final : public SuspendableTimer { | 148 class PostMessageTimer final : public SuspendableTimer { |
133 public: | 149 public: |
134 PostMessageTimer(LocalDOMWindow& window, PassRefPtr<SerializedScriptValue> m
essage, const String& sourceOrigin, PassRefPtrWillBeRawPtr<LocalDOMWindow> sourc
e, PassOwnPtr<MessagePortChannelArray> channels, SecurityOrigin* targetOrigin, P
assRefPtrWillBeRawPtr<ScriptCallStack> stackTrace, UserGestureToken* userGesture
Token) | 150 PostMessageTimer(LocalDOMWindow& window, PassRefPtr<SerializedScriptValue> m
essage, const String& sourceOrigin, PassRefPtrWillBeRawPtr<LocalDOMWindow> sourc
e, PassOwnPtr<MessagePortChannelArray> channels, SecurityOrigin* targetOrigin, P
assRefPtrWillBeRawPtr<ScriptCallStack> stackTrace, UserGestureToken* userGesture
Token) |
135 : SuspendableTimer(window.document()) | 151 : SuspendableTimer(window.document()) |
136 , m_window(&window) | 152 , m_window(&window) |
137 , m_message(message) | 153 , m_message(message) |
138 , m_origin(sourceOrigin) | 154 , m_origin(sourceOrigin) |
139 , m_source(source) | 155 , m_source(source) |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 { | 358 { |
343 if (!frame) | 359 if (!frame) |
344 return false; | 360 return false; |
345 FrameHost* host = frame->host(); | 361 FrameHost* host = frame->host(); |
346 if (!host) | 362 if (!host) |
347 return false; | 363 return false; |
348 return host->chrome().canRunModalNow(); | 364 return host->chrome().canRunModalNow(); |
349 } | 365 } |
350 | 366 |
351 LocalDOMWindow::LocalDOMWindow(LocalFrame& frame) | 367 LocalDOMWindow::LocalDOMWindow(LocalFrame& frame) |
352 : m_frameObserver(*this, frame) | 368 : m_frameObserver(WindowFrameObserver::create(this, frame)) |
353 , m_shouldPrintWhenFinishedLoading(false) | 369 , m_shouldPrintWhenFinishedLoading(false) |
354 #if ENABLE(ASSERT) | 370 #if ENABLE(ASSERT) |
355 , m_hasBeenReset(false) | 371 , m_hasBeenReset(false) |
356 #endif | 372 #endif |
357 { | 373 { |
358 } | 374 } |
359 | 375 |
360 void LocalDOMWindow::clearDocument() | 376 void LocalDOMWindow::clearDocument() |
361 { | 377 { |
362 if (!m_document) | 378 if (!m_document) |
(...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1903 } | 1919 } |
1904 | 1920 |
1905 PassOwnPtr<LifecycleNotifier<LocalDOMWindow> > LocalDOMWindow::createLifecycleNo
tifier() | 1921 PassOwnPtr<LifecycleNotifier<LocalDOMWindow> > LocalDOMWindow::createLifecycleNo
tifier() |
1906 { | 1922 { |
1907 return DOMWindowLifecycleNotifier::create(this); | 1923 return DOMWindowLifecycleNotifier::create(this); |
1908 } | 1924 } |
1909 | 1925 |
1910 void LocalDOMWindow::trace(Visitor* visitor) | 1926 void LocalDOMWindow::trace(Visitor* visitor) |
1911 { | 1927 { |
1912 #if ENABLE(OILPAN) | 1928 #if ENABLE(OILPAN) |
| 1929 visitor->trace(m_frameObserver); |
1913 visitor->trace(m_document); | 1930 visitor->trace(m_document); |
1914 visitor->trace(m_properties); | 1931 visitor->trace(m_properties); |
1915 visitor->trace(m_screen); | 1932 visitor->trace(m_screen); |
1916 visitor->trace(m_history); | 1933 visitor->trace(m_history); |
1917 visitor->trace(m_locationbar); | 1934 visitor->trace(m_locationbar); |
1918 visitor->trace(m_menubar); | 1935 visitor->trace(m_menubar); |
1919 visitor->trace(m_personalbar); | 1936 visitor->trace(m_personalbar); |
1920 visitor->trace(m_scrollbars); | 1937 visitor->trace(m_scrollbars); |
1921 visitor->trace(m_statusbar); | 1938 visitor->trace(m_statusbar); |
1922 visitor->trace(m_toolbar); | 1939 visitor->trace(m_toolbar); |
1923 visitor->trace(m_console); | 1940 visitor->trace(m_console); |
1924 visitor->trace(m_navigator); | 1941 visitor->trace(m_navigator); |
1925 visitor->trace(m_location); | 1942 visitor->trace(m_location); |
1926 visitor->trace(m_media); | 1943 visitor->trace(m_media); |
1927 visitor->trace(m_sessionStorage); | 1944 visitor->trace(m_sessionStorage); |
1928 visitor->trace(m_localStorage); | 1945 visitor->trace(m_localStorage); |
1929 visitor->trace(m_applicationCache); | 1946 visitor->trace(m_applicationCache); |
1930 visitor->trace(m_performance); | 1947 visitor->trace(m_performance); |
1931 visitor->trace(m_css); | 1948 visitor->trace(m_css); |
1932 visitor->trace(m_eventQueue); | 1949 visitor->trace(m_eventQueue); |
1933 HeapSupplementable<LocalDOMWindow>::trace(visitor); | 1950 HeapSupplementable<LocalDOMWindow>::trace(visitor); |
1934 #endif | 1951 #endif |
1935 visitor->trace(m_frameObserver); | |
1936 DOMWindow::trace(visitor); | 1952 DOMWindow::trace(visitor); |
1937 LifecycleContext<LocalDOMWindow>::trace(visitor); | 1953 LifecycleContext<LocalDOMWindow>::trace(visitor); |
1938 } | 1954 } |
1939 | 1955 |
1940 LocalFrame* LocalDOMWindow::frame() const | 1956 LocalFrame* LocalDOMWindow::frame() const |
1941 { | 1957 { |
1942 return m_frameObserver.frame(); | 1958 return m_frameObserver->frame(); |
1943 } | 1959 } |
1944 | 1960 |
1945 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) | 1961 v8::Handle<v8::Object> LocalDOMWindow::wrap(v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) |
1946 { | 1962 { |
1947 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. | 1963 ASSERT_NOT_REACHED(); // LocalDOMWindow has [Custom=ToV8]. |
1948 return v8::Handle<v8::Object>(); | 1964 return v8::Handle<v8::Object>(); |
1949 } | 1965 } |
1950 | 1966 |
1951 } // namespace blink | 1967 } // namespace blink |
OLD | NEW |