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

Side by Side Diff: Source/modules/filesystem/SyncCallbackHelper.h

Issue 111603006: Simplify invokeCallback() and support void return values for IDL callbacks (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years 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
OLDNEW
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 : 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 bool handleEvent() 114 virtual void handleEvent()
115 { 115 {
116 m_helper->setError(FileError::OK); 116 m_helper->setError(FileError::OK);
117 return true;
118 } 117 }
119 118
120 virtual bool handleEvent(CallbackArg arg) 119 virtual void handleEvent(CallbackArg arg)
121 { 120 {
122 m_helper->setResult(arg); 121 m_helper->setResult(arg);
123 return true;
124 } 122 }
125 123
126 private: 124 private:
127 explicit SuccessCallbackImpl(HelperType* helper) 125 explicit SuccessCallbackImpl(HelperType* helper)
128 : m_helper(helper) 126 : m_helper(helper)
129 { 127 {
130 } 128 }
131 HelperType* m_helper; 129 HelperType* m_helper;
132 }; 130 };
133 131
134 class ErrorCallbackImpl : public ErrorCallback { 132 class ErrorCallbackImpl : public ErrorCallback {
135 public: 133 public:
136 static PassOwnPtr<ErrorCallbackImpl> create(HelperType* helper) 134 static PassOwnPtr<ErrorCallbackImpl> create(HelperType* helper)
137 { 135 {
138 return adoptPtr(new ErrorCallbackImpl(helper)); 136 return adoptPtr(new ErrorCallbackImpl(helper));
139 } 137 }
140 138
141 virtual bool handleEvent(FileError* error) 139 virtual void handleEvent(FileError* error)
142 { 140 {
143 ASSERT(error); 141 ASSERT(error);
144 m_helper->setError(error->code()); 142 m_helper->setError(error->code());
145 return true;
146 } 143 }
147 144
148 private: 145 private:
149 explicit ErrorCallbackImpl(HelperType* helper) 146 explicit ErrorCallbackImpl(HelperType* helper)
150 : m_helper(helper) 147 : m_helper(helper)
151 { 148 {
152 } 149 }
153 HelperType* m_helper; 150 HelperType* m_helper;
154 }; 151 };
155 152
(...skipping 23 matching lines...) Expand all
179 176
180 typedef SyncCallbackHelper<EntryCallback, Entry*, EntrySync> EntrySyncCallbackHe lper; 177 typedef SyncCallbackHelper<EntryCallback, Entry*, EntrySync> EntrySyncCallbackHe lper;
181 typedef SyncCallbackHelper<EntriesCallback, const EntryVector&, EntrySyncVector> EntriesSyncCallbackHelper; 178 typedef SyncCallbackHelper<EntriesCallback, const EntryVector&, EntrySyncVector> EntriesSyncCallbackHelper;
182 typedef SyncCallbackHelper<MetadataCallback, Metadata*, Metadata> MetadataSyncCa llbackHelper; 179 typedef SyncCallbackHelper<MetadataCallback, Metadata*, Metadata> MetadataSyncCa llbackHelper;
183 typedef SyncCallbackHelper<VoidCallback, EmptyType*, EmptyType> VoidSyncCallback Helper; 180 typedef SyncCallbackHelper<VoidCallback, EmptyType*, EmptyType> VoidSyncCallback Helper;
184 typedef SyncCallbackHelper<FileSystemCallback, DOMFileSystem*, DOMFileSystemSync > FileSystemSyncCallbackHelper; 181 typedef SyncCallbackHelper<FileSystemCallback, DOMFileSystem*, DOMFileSystemSync > FileSystemSyncCallbackHelper;
185 182
186 } // namespace WebCore 183 } // namespace WebCore
187 184
188 #endif // SyncCallbackHelper_h 185 #endif // SyncCallbackHelper_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698