Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(991)

Unified Diff: Source/core/html/HTMLFrameJavaScriptURLOpener.h

Issue 221673003: Defer iframe JavaScript URL evaluation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/html/HTMLFrameJavaScriptURLOpener.h
diff --git a/Source/core/fileapi/FileList.h b/Source/core/html/HTMLFrameJavaScriptURLOpener.h
similarity index 53%
copy from Source/core/fileapi/FileList.h
copy to Source/core/html/HTMLFrameJavaScriptURLOpener.h
index 736a6fcb84be552e1fc0b748dfa488839a394421..a0e82aeb14e225a20ec11a0207be86045fa63d53 100644
--- a/Source/core/fileapi/FileList.h
+++ b/Source/core/html/HTMLFrameJavaScriptURLOpener.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2014 Google, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,42 +23,55 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef FileList_h
-#define FileList_h
+#ifndef HTMLFrameJavaScriptURLOpener_h
+#define HTMLFrameJavaScriptURLOpener_h
-#include "bindings/v8/ScriptWrappable.h"
-#include "core/fileapi/File.h"
-#include "heap/Handle.h"
-#include "wtf/PassRefPtr.h"
+#include "platform/weborigin/KURL.h"
#include "wtf/RefCounted.h"
#include "wtf/RefPtr.h"
#include "wtf/Vector.h"
namespace WebCore {
-class FileList : public RefCountedWillBeGarbageCollectedFinalized<FileList>, public ScriptWrappable {
-public:
- static PassRefPtrWillBeRawPtr<FileList> create()
- {
- return adoptRefWillBeNoop(new FileList);
- }
+class Document;
+class HTMLFrameElementBase;
- unsigned length() const { return m_files.size(); }
- File* item(unsigned index) const;
+// FIXME: Some day, this could be implemented as a C++ level
+// equivalent of custom element enterView callback.
+// We don't have that yet, so uses timer for a while.
+class HTMLFrameJavaScriptURLOpener {
+ WTF_MAKE_NONCOPYABLE(HTMLFrameJavaScriptURLOpener); WTF_MAKE_FAST_ALLOCATED;
+public:
+ ~HTMLFrameJavaScriptURLOpener();
- bool isEmpty() const { return m_files.isEmpty(); }
- void clear() { m_files.clear(); }
- void append(PassRefPtrWillBeRawPtr<File> file) { m_files.append(file); }
- Vector<String> paths() const;
+ void request(PassRefPtr<HTMLFrameElementBase>);
+ void processPendingRequests();
- void trace(Visitor*);
+ static HTMLFrameJavaScriptURLOpener& instance();
private:
- FileList();
+ static void microtaskCallback();
+
+ HTMLFrameJavaScriptURLOpener();
+
+ class Request : public RefCounted<Request> {
+ WTF_MAKE_NONCOPYABLE(Request); WTF_MAKE_FAST_ALLOCATED;
+ public:
+ explicit Request(PassRefPtr<HTMLFrameElementBase>);
+ ~Request();
+
+ void setNameAndOpenURL();
+
+ private:
+ RefPtr<HTMLFrameElementBase> m_element;
+ RefPtr<Document> m_document;
+ AtomicString m_lastURL;
+ };
- WillBeHeapVector<RefPtrWillBeMember<File> > m_files;
+ Vector<RefPtr<Request> > m_requests;
+ bool m_enqueued;
};
-} // namespace WebCore
+}
-#endif // FileList_h
+#endif

Powered by Google App Engine
This is Rietveld 408576698