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

Side by Side Diff: Source/core/dom/PendingScript.h

Issue 368283002: Stream scripts to V8 as they load - Blink side. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: removed untrue assert Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/Init.cpp ('k') | Source/core/dom/PendingScript.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2010 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 20 matching lines...) Expand all
31 #include "core/fetch/ResourceClient.h" 31 #include "core/fetch/ResourceClient.h"
32 #include "core/fetch/ResourceOwner.h" 32 #include "core/fetch/ResourceOwner.h"
33 #include "core/fetch/ScriptResource.h" 33 #include "core/fetch/ScriptResource.h"
34 #include "platform/heap/Handle.h" 34 #include "platform/heap/Handle.h"
35 #include "wtf/PassRefPtr.h" 35 #include "wtf/PassRefPtr.h"
36 #include "wtf/RefPtr.h" 36 #include "wtf/RefPtr.h"
37 #include "wtf/text/TextPosition.h" 37 #include "wtf/text/TextPosition.h"
38 38
39 namespace blink { 39 namespace blink {
40 40
41 class ScriptResource; 41 class ScriptStreamer;
42 42
43 // A container for an external script which may be loaded and executed. 43 // A container for an external script which may be loaded and executed.
44 // 44 //
45 // A ResourcePtr alone does not prevent the underlying Resource 45 // A ResourcePtr alone does not prevent the underlying Resource
46 // from purging its data buffer. This class holds a dummy client open for its 46 // from purging its data buffer. This class holds a dummy client open for its
47 // lifetime in order to guarantee that the data buffer will not be purged. 47 // lifetime in order to guarantee that the data buffer will not be purged.
48 class PendingScript FINAL : public ResourceOwner<ScriptResource> { 48 class PendingScript FINAL : public ResourceOwner<ScriptResource> {
49 ALLOW_ONLY_INLINE_ALLOCATION(); 49 ALLOW_ONLY_INLINE_ALLOCATION();
50 public: 50 public:
51 PendingScript() 51 PendingScript()
(...skipping 21 matching lines...) Expand all
73 ~PendingScript(); 73 ~PendingScript();
74 74
75 PendingScript& operator=(const PendingScript& other) 75 PendingScript& operator=(const PendingScript& other)
76 { 76 {
77 if (this == &other) 77 if (this == &other)
78 return *this; 78 return *this;
79 79
80 m_watchingForLoad = other.m_watchingForLoad; 80 m_watchingForLoad = other.m_watchingForLoad;
81 m_element = other.m_element; 81 m_element = other.m_element;
82 m_startingPosition = other.m_startingPosition; 82 m_startingPosition = other.m_startingPosition;
83 this->ResourceOwner<ScriptResource, ResourceClient>::operator=(other); 83 m_streamer = other.m_streamer;
84 84 this->ResourceOwner<ScriptResource, ScriptResourceClient>::operator=(oth er);
85 return *this; 85 return *this;
86 } 86 }
87 87
88 TextPosition startingPosition() const { return m_startingPosition; } 88 TextPosition startingPosition() const { return m_startingPosition; }
89 void setStartingPosition(const TextPosition& position) { m_startingPosition = position; } 89 void setStartingPosition(const TextPosition& position) { m_startingPosition = position; }
90 90
91 void watchForLoad(ResourceClient*); 91 void watchForLoad(ScriptResourceClient*);
92 void stopWatchingForLoad(ResourceClient*); 92 void stopWatchingForLoad(ScriptResourceClient*);
93 93
94 Element* element() const { return m_element.get(); } 94 Element* element() const { return m_element.get(); }
95 void setElement(Element* element) { m_element = element; } 95 void setElement(Element* element) { m_element = element; }
96 PassRefPtrWillBeRawPtr<Element> releaseElementAndClear(); 96 PassRefPtrWillBeRawPtr<Element> releaseElementAndClear();
97 97
98 void setScriptResource(ScriptResource*); 98 void setScriptResource(ScriptResource*);
99 99
100 virtual void notifyFinished(Resource*); 100 virtual void notifyFinished(Resource*);
101 virtual void notifyAppendData(ScriptResource*);
101 102
102 void trace(Visitor*); 103 void trace(Visitor*);
103 104
104 ScriptSourceCode getSource(const KURL& documentURL, bool& errorOccurred) con st; 105 ScriptSourceCode getSource(const KURL& documentURL, bool& errorOccurred) con st;
105 106
107 void setStreamer(PassRefPtr<ScriptStreamer> streamer)
108 {
109 ASSERT(!m_streamer);
110 ASSERT(!m_watchingForLoad);
111 m_streamer = streamer;
112 }
113
114 bool isStreaming() const;
115
106 private: 116 private:
107 bool m_watchingForLoad; 117 bool m_watchingForLoad;
108 RefPtrWillBeMember<Element> m_element; 118 RefPtrWillBeMember<Element> m_element;
109 TextPosition m_startingPosition; // Only used for inline script tags. 119 TextPosition m_startingPosition; // Only used for inline script tags.
120
121 RefPtr<ScriptStreamer> m_streamer;
110 }; 122 };
111 123
112 } 124 }
113 125
114 #endif 126 #endif
OLDNEW
« no previous file with comments | « Source/core/Init.cpp ('k') | Source/core/dom/PendingScript.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698