OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/frame/DOMWindow.h" | 5 #include "core/frame/DOMWindow.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptCallStackFactory.h" | 7 #include "bindings/core/v8/ScriptCallStackFactory.h" |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/dom/ExceptionCode.h" | 9 #include "core/dom/ExceptionCode.h" |
10 #include "core/dom/ExecutionContext.h" | 10 #include "core/dom/ExecutionContext.h" |
11 #include "core/dom/SecurityContext.h" | 11 #include "core/dom/SecurityContext.h" |
12 #include "core/events/MessageEvent.h" | 12 #include "core/events/MessageEvent.h" |
13 #include "core/frame/Frame.h" | 13 #include "core/frame/Frame.h" |
14 #include "core/frame/FrameClient.h" | 14 #include "core/frame/FrameClient.h" |
15 #include "core/frame/FrameConsole.h" | 15 #include "core/frame/FrameConsole.h" |
16 #include "core/frame/LocalDOMWindow.h" | 16 #include "core/frame/LocalDOMWindow.h" |
17 #include "core/frame/Location.h" | 17 #include "core/frame/Location.h" |
18 #include "core/frame/RemoteFrame.h" | 18 #include "core/frame/RemoteFrame.h" |
19 #include "core/frame/Settings.h" | 19 #include "core/frame/Settings.h" |
20 #include "core/frame/UseCounter.h" | 20 #include "core/frame/UseCounter.h" |
21 #include "core/input/EventHandler.h" | 21 #include "core/input/EventHandler.h" |
22 #include "core/inspector/ConsoleMessageStorage.h" | 22 #include "core/inspector/ConsoleMessageStorage.h" |
23 #include "core/inspector/InspectorInstrumentation.h" | 23 #include "core/inspector/InspectorInstrumentation.h" |
24 #include "core/inspector/ScriptCallStack.h" | 24 #include "core/inspector/ScriptCallStack.h" |
25 #include "core/loader/FrameLoaderClient.h" | 25 #include "core/loader/FrameLoaderClient.h" |
26 #include "core/loader/MixedContentChecker.h" | 26 #include "core/loader/MixedContentChecker.h" |
27 #include "core/page/ChromeClient.h" | 27 #include "core/page/ChromeClient.h" |
28 #include "core/page/FocusController.h" | 28 #include "core/page/FocusController.h" |
29 #include "core/page/Page.h" | 29 #include "core/page/Page.h" |
| 30 #include "platform/MemoryPurgeController.h" |
30 #include "platform/weborigin/KURL.h" | 31 #include "platform/weborigin/KURL.h" |
31 #include "platform/weborigin/SecurityOrigin.h" | 32 #include "platform/weborigin/SecurityOrigin.h" |
32 | 33 |
33 namespace blink { | 34 namespace blink { |
34 | 35 |
35 DOMWindow::DOMWindow() | 36 DOMWindow::DOMWindow() |
36 : m_windowIsClosing(false) | 37 : m_windowIsClosing(false) |
37 { | 38 { |
38 } | 39 } |
39 | 40 |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 allowFocus = opener() && (opener() != this) && (toDocument(context)->dom
Window() == opener()); | 362 allowFocus = opener() && (opener() != this) && (toDocument(context)->dom
Window() == opener()); |
362 } | 363 } |
363 | 364 |
364 // If we're a top level window, bring the window to the front. | 365 // If we're a top level window, bring the window to the front. |
365 if (frame()->isMainFrame() && allowFocus) | 366 if (frame()->isMainFrame() && allowFocus) |
366 page->chromeClient().focus(); | 367 page->chromeClient().focus(); |
367 | 368 |
368 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */
); | 369 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */
); |
369 } | 370 } |
370 | 371 |
| 372 void DOMWindow::purgeMemory(ExceptionState& exceptionState) |
| 373 { |
| 374 Document* currentDocument = document(); |
| 375 if (!currentDocument || !currentDocument->page()) { |
| 376 exceptionState.throwDOMException(InvalidAccessError, currentDocument ? "
The document's page cannot be retrieved." : "No context document can be obtained
."); |
| 377 return; |
| 378 } |
| 379 MemoryPurgeController& controller = currentDocument->page()->memoryPurgeCont
roller(); |
| 380 controller.purgeMemory(); |
| 381 } |
| 382 |
371 DEFINE_TRACE(DOMWindow) | 383 DEFINE_TRACE(DOMWindow) |
372 { | 384 { |
373 visitor->trace(m_location); | 385 visitor->trace(m_location); |
374 EventTargetWithInlineData::trace(visitor); | 386 EventTargetWithInlineData::trace(visitor); |
375 } | 387 } |
376 | 388 |
377 } // namespace blink | 389 } // namespace blink |
OLD | NEW |