Index: third_party/WebKit/Source/core/frame/DOMWindow.cpp |
diff --git a/third_party/WebKit/Source/core/frame/DOMWindow.cpp b/third_party/WebKit/Source/core/frame/DOMWindow.cpp |
index 2a86da71d221ddebc047a2fb71340e0eb8a77c9a..2a0e23ea67619ac8d1591be3fcb10f02c1d9f879 100644 |
--- a/third_party/WebKit/Source/core/frame/DOMWindow.cpp |
+++ b/third_party/WebKit/Source/core/frame/DOMWindow.cpp |
@@ -27,6 +27,7 @@ |
#include "core/page/ChromeClient.h" |
#include "core/page/FocusController.h" |
#include "core/page/Page.h" |
+#include "platform/MemoryPurgeController.h" |
#include "platform/weborigin/KURL.h" |
#include "platform/weborigin/SecurityOrigin.h" |
@@ -368,6 +369,17 @@ void DOMWindow::focus(ExecutionContext* context) |
page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */); |
} |
+void DOMWindow::purgeMemory(ExceptionState& exceptionState) |
+{ |
+ Document* currentDocument = document(); |
+ if (!currentDocument || !currentDocument->page()) { |
+ exceptionState.throwDOMException(InvalidAccessError, currentDocument ? "The document's page cannot be retrieved." : "No context document can be obtained."); |
+ return; |
+ } |
+ MemoryPurgeController& controller = currentDocument->page()->memoryPurgeController(); |
+ controller.purgeMemory(); |
+} |
+ |
DEFINE_TRACE(DOMWindow) |
{ |
visitor->trace(m_location); |