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

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

Issue 909043003: FileReader.result attribute should use IDL union types to avoid using custom binding. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « Source/bindings/core/v8/custom/custom.gypi ('k') | Source/core/fileapi/FileReader.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 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 28 matching lines...) Expand all
39 #include "platform/heap/Handle.h" 39 #include "platform/heap/Handle.h"
40 #include "wtf/Forward.h" 40 #include "wtf/Forward.h"
41 #include "wtf/RefCounted.h" 41 #include "wtf/RefCounted.h"
42 42
43 namespace blink { 43 namespace blink {
44 44
45 class Blob; 45 class Blob;
46 class DOMArrayBuffer; 46 class DOMArrayBuffer;
47 class ExceptionState; 47 class ExceptionState;
48 class ExecutionContext; 48 class ExecutionContext;
49 class StringOrArrayBuffer;
49 50
50 class FileReader final : public RefCountedGarbageCollectedEventTargetWithInlineD ata<FileReader>, public ActiveDOMObject, public FileReaderLoaderClient { 51 class FileReader final : public RefCountedGarbageCollectedEventTargetWithInlineD ata<FileReader>, public ActiveDOMObject, public FileReaderLoaderClient {
51 DEFINE_WRAPPERTYPEINFO(); 52 DEFINE_WRAPPERTYPEINFO();
52 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<F ileReader>); 53 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<F ileReader>);
53 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(FileReader); 54 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(FileReader);
54 public: 55 public:
55 static FileReader* create(ExecutionContext*); 56 static FileReader* create(ExecutionContext*);
56 57
57 virtual ~FileReader(); 58 virtual ~FileReader();
58 59
59 enum ReadyState { 60 enum ReadyState {
60 EMPTY = 0, 61 EMPTY = 0,
61 LOADING = 1, 62 LOADING = 1,
62 DONE = 2 63 DONE = 2
63 }; 64 };
64 65
65 void readAsArrayBuffer(Blob*, ExceptionState&); 66 void readAsArrayBuffer(Blob*, ExceptionState&);
66 void readAsBinaryString(Blob*, ExceptionState&); 67 void readAsBinaryString(Blob*, ExceptionState&);
67 void readAsText(Blob*, const String& encoding, ExceptionState&); 68 void readAsText(Blob*, const String& encoding, ExceptionState&);
68 void readAsText(Blob*, ExceptionState&); 69 void readAsText(Blob*, ExceptionState&);
69 void readAsDataURL(Blob*, ExceptionState&); 70 void readAsDataURL(Blob*, ExceptionState&);
70 void abort(); 71 void abort();
71 72
72 void doAbort(); 73 void doAbort();
73 74
74 ReadyState readyState() const { return m_state; } 75 ReadyState readyState() const { return m_state; }
75 FileError* error() { return m_error; } 76 FileError* error() { return m_error; }
76 FileReaderLoader::ReadType readType() const { return m_readType; } 77 void result(StringOrArrayBuffer& resultAttribute) const;
77 PassRefPtr<DOMArrayBuffer> arrayBufferResult() const;
78 String stringResult();
79 78
80 // ActiveDOMObject 79 // ActiveDOMObject
81 virtual void stop() override; 80 virtual void stop() override;
82 virtual bool hasPendingActivity() const override; 81 virtual bool hasPendingActivity() const override;
83 82
84 // EventTarget 83 // EventTarget
85 virtual const AtomicString& interfaceName() const override; 84 virtual const AtomicString& interfaceName() const override;
86 virtual ExecutionContext* executionContext() const override { return ActiveD OMObject::executionContext(); } 85 virtual ExecutionContext* executionContext() const override { return ActiveD OMObject::executionContext(); }
87 86
88 // FileReaderLoaderClient 87 // FileReaderLoaderClient
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 129
131 OwnPtr<FileReaderLoader> m_loader; 130 OwnPtr<FileReaderLoader> m_loader;
132 Member<FileError> m_error; 131 Member<FileError> m_error;
133 double m_lastProgressNotificationTimeMS; 132 double m_lastProgressNotificationTimeMS;
134 int m_asyncOperationId; 133 int m_asyncOperationId;
135 }; 134 };
136 135
137 } // namespace blink 136 } // namespace blink
138 137
139 #endif // FileReader_h 138 #endif // FileReader_h
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/custom/custom.gypi ('k') | Source/core/fileapi/FileReader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698