OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. | 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 if (m_errorCode) | 97 if (m_errorCode) |
98 FileError::throwDOMException(exceptionState, m_errorCode); | 98 FileError::throwDOMException(exceptionState, m_errorCode); |
99 | 99 |
100 return m_result; | 100 return m_result; |
101 } | 101 } |
102 | 102 |
103 PassOwnPtr<SuccessCallback> successCallback() { return SuccessCallbackImpl::
create(this); } | 103 PassOwnPtr<SuccessCallback> successCallback() { return SuccessCallbackImpl::
create(this); } |
104 PassOwnPtr<ErrorCallback> errorCallback() { return ErrorCallbackImpl::create
(this); } | 104 PassOwnPtr<ErrorCallback> errorCallback() { return ErrorCallbackImpl::create
(this); } |
105 | 105 |
106 private: | 106 private: |
107 class SuccessCallbackImpl : public SuccessCallback { | 107 class SuccessCallbackImpl FINAL : public SuccessCallback { |
108 public: | 108 public: |
109 static PassOwnPtr<SuccessCallbackImpl> create(HelperType* helper) | 109 static PassOwnPtr<SuccessCallbackImpl> create(HelperType* helper) |
110 { | 110 { |
111 return adoptPtr(new SuccessCallbackImpl(helper)); | 111 return adoptPtr(new SuccessCallbackImpl(helper)); |
112 } | 112 } |
113 | 113 |
114 virtual void handleEvent() | 114 virtual void handleEvent() |
115 { | 115 { |
116 m_helper->setError(FileError::OK); | 116 m_helper->setError(FileError::OK); |
117 } | 117 } |
118 | 118 |
119 virtual void handleEvent(CallbackArg arg) | 119 virtual void handleEvent(CallbackArg arg) |
120 { | 120 { |
121 m_helper->setResult(arg); | 121 m_helper->setResult(arg); |
122 } | 122 } |
123 | 123 |
124 private: | 124 private: |
125 explicit SuccessCallbackImpl(HelperType* helper) | 125 explicit SuccessCallbackImpl(HelperType* helper) |
126 : m_helper(helper) | 126 : m_helper(helper) |
127 { | 127 { |
128 } | 128 } |
129 HelperType* m_helper; | 129 HelperType* m_helper; |
130 }; | 130 }; |
131 | 131 |
132 class ErrorCallbackImpl : public ErrorCallback { | 132 class ErrorCallbackImpl FINAL : public ErrorCallback { |
133 public: | 133 public: |
134 static PassOwnPtr<ErrorCallbackImpl> create(HelperType* helper) | 134 static PassOwnPtr<ErrorCallbackImpl> create(HelperType* helper) |
135 { | 135 { |
136 return adoptPtr(new ErrorCallbackImpl(helper)); | 136 return adoptPtr(new ErrorCallbackImpl(helper)); |
137 } | 137 } |
138 | 138 |
139 virtual void handleEvent(FileError* error) | 139 virtual void handleEvent(FileError* error) OVERRIDE |
140 { | 140 { |
141 ASSERT(error); | 141 ASSERT(error); |
142 m_helper->setError(error->code()); | 142 m_helper->setError(error->code()); |
143 } | 143 } |
144 | 144 |
145 private: | 145 private: |
146 explicit ErrorCallbackImpl(HelperType* helper) | 146 explicit ErrorCallbackImpl(HelperType* helper) |
147 : m_helper(helper) | 147 : m_helper(helper) |
148 { | 148 { |
149 } | 149 } |
(...skipping 26 matching lines...) Expand all Loading... |
176 | 176 |
177 typedef SyncCallbackHelper<EntryCallback, Entry*, EntrySync> EntrySyncCallbackHe
lper; | 177 typedef SyncCallbackHelper<EntryCallback, Entry*, EntrySync> EntrySyncCallbackHe
lper; |
178 typedef SyncCallbackHelper<EntriesCallback, const EntryVector&, EntrySyncVector>
EntriesSyncCallbackHelper; | 178 typedef SyncCallbackHelper<EntriesCallback, const EntryVector&, EntrySyncVector>
EntriesSyncCallbackHelper; |
179 typedef SyncCallbackHelper<MetadataCallback, Metadata*, Metadata> MetadataSyncCa
llbackHelper; | 179 typedef SyncCallbackHelper<MetadataCallback, Metadata*, Metadata> MetadataSyncCa
llbackHelper; |
180 typedef SyncCallbackHelper<VoidCallback, EmptyType*, EmptyType> VoidSyncCallback
Helper; | 180 typedef SyncCallbackHelper<VoidCallback, EmptyType*, EmptyType> VoidSyncCallback
Helper; |
181 typedef SyncCallbackHelper<FileSystemCallback, DOMFileSystem*, DOMFileSystemSync
> FileSystemSyncCallbackHelper; | 181 typedef SyncCallbackHelper<FileSystemCallback, DOMFileSystem*, DOMFileSystemSync
> FileSystemSyncCallbackHelper; |
182 | 182 |
183 } // namespace WebCore | 183 } // namespace WebCore |
184 | 184 |
185 #endif // SyncCallbackHelper_h | 185 #endif // SyncCallbackHelper_h |
OLD | NEW |