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

Side by Side Diff: Source/core/fileapi/FileReader.h

Issue 399863002: Gracefully handle FileReader() read operations when in a detached state. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Throw AbortError (instead of InvalidStateError.) Created 6 years, 5 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
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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadstart); 93 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadstart);
94 DEFINE_ATTRIBUTE_EVENT_LISTENER(progress); 94 DEFINE_ATTRIBUTE_EVENT_LISTENER(progress);
95 DEFINE_ATTRIBUTE_EVENT_LISTENER(load); 95 DEFINE_ATTRIBUTE_EVENT_LISTENER(load);
96 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); 96 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort);
97 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); 97 DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
98 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadend); 98 DEFINE_ATTRIBUTE_EVENT_LISTENER(loadend);
99 99
100 virtual void trace(Visitor*) OVERRIDE; 100 virtual void trace(Visitor*) OVERRIDE;
101 101
102 private: 102 private:
103 explicit FileReader(ExecutionContext*);
104
103 class ThrottlingController; 105 class ThrottlingController;
104 106
105 FileReader(ExecutionContext*);
106
107 void terminate(); 107 void terminate();
108 void readInternal(Blob*, FileReaderLoader::ReadType, ExceptionState&); 108 void readInternal(Blob*, FileReaderLoader::ReadType, ExceptionState&);
109 void fireErrorEvent(int httpStatusCode); 109 void fireErrorEvent(int httpStatusCode);
110 void fireEvent(const AtomicString& type); 110 void fireEvent(const AtomicString& type);
111 111
112 ThrottlingController* throttlingController();
113 void executePendingRead(); 112 void executePendingRead();
114 113
115 ReadyState m_state; 114 ReadyState m_state;
116 115
117 // Internal loading state, which could differ from ReadyState as it's 116 // Internal loading state, which could differ from ReadyState as it's
118 // for script-visible state while this one's for internal state. 117 // for script-visible state while this one's for internal state.
119 enum LoadingState { 118 enum LoadingState {
120 LoadingStateNone, 119 LoadingStateNone,
121 LoadingStatePending, 120 LoadingStatePending,
122 LoadingStateLoading, 121 LoadingStateLoading,
123 LoadingStateAborted 122 LoadingStateAborted
124 }; 123 };
125 LoadingState m_loadingState; 124 LoadingState m_loadingState;
126 125
127 String m_blobType; 126 String m_blobType;
128 RefPtr<BlobDataHandle> m_blobDataHandle; 127 RefPtr<BlobDataHandle> m_blobDataHandle;
129 FileReaderLoader::ReadType m_readType; 128 FileReaderLoader::ReadType m_readType;
130 String m_encoding; 129 String m_encoding;
131 130
132 OwnPtr<FileReaderLoader> m_loader; 131 OwnPtr<FileReaderLoader> m_loader;
133 RefPtrWillBeMember<FileError> m_error; 132 RefPtrWillBeMember<FileError> m_error;
134 double m_lastProgressNotificationTimeMS; 133 double m_lastProgressNotificationTimeMS;
135 }; 134 };
136 135
137 } // namespace WebCore 136 } // namespace WebCore
138 137
139 #endif // FileReader_h 138 #endif // FileReader_h
OLDNEW
« no previous file with comments | « LayoutTests/fast/files/resources/file-reader-detached-no-crash-new-window.html ('k') | Source/core/fileapi/FileReader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698