Chromium Code Reviews| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 #include "wtf/PassRefPtr.h" | 47 #include "wtf/PassRefPtr.h" |
| 48 #include "wtf/RefCounted.h" | 48 #include "wtf/RefCounted.h" |
| 49 | 49 |
| 50 namespace WebCore { | 50 namespace WebCore { |
| 51 | 51 |
| 52 template <typename ResultType, typename CallbackArg> | 52 template <typename ResultType, typename CallbackArg> |
| 53 struct HelperResultType { | 53 struct HelperResultType { |
| 54 DISALLOW_ALLOCATION(); | 54 DISALLOW_ALLOCATION(); |
| 55 public: | 55 public: |
| 56 typedef PassRefPtrWillBeRawPtr<ResultType> ReturnType; | 56 typedef PassRefPtrWillBeRawPtr<ResultType> ReturnType; |
| 57 typedef RefPtrWillBeRawPtr<ResultType> StorageType; | 57 typedef RefPtrWillBeMember<ResultType> StorageType; |
| 58 | 58 |
| 59 static ReturnType createFromCallbackArg(CallbackArg argument) | 59 static ReturnType createFromCallbackArg(CallbackArg argument) |
| 60 { | 60 { |
| 61 return ResultType::create(argument); | 61 return ResultType::create(argument); |
| 62 } | 62 } |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 // A helper template for FileSystemSync implementation. | 65 // A helper template for FileSystemSync implementation. |
| 66 template <typename SuccessCallback, typename CallbackArg, typename ResultType> | 66 template <typename SuccessCallback, typename CallbackArg, typename ResultType> |
| 67 class SyncCallbackHelper { | 67 class SyncCallbackHelper { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 { | 147 { |
| 148 m_result = ResultTypeTrait::createFromCallbackArg(result); | 148 m_result = ResultTypeTrait::createFromCallbackArg(result); |
| 149 m_completed = true; | 149 m_completed = true; |
| 150 } | 150 } |
| 151 | 151 |
| 152 ResultStorageType m_result; | 152 ResultStorageType m_result; |
| 153 FileError::ErrorCode m_errorCode; | 153 FileError::ErrorCode m_errorCode; |
| 154 bool m_completed; | 154 bool m_completed; |
| 155 }; | 155 }; |
| 156 | 156 |
| 157 struct EmptyType : public RefCounted<EmptyType> { | 157 struct EmptyType : public RefCountedWillBeGarbageCollected<EmptyType> { |
|
haraken
2014/03/24 07:05:03
I don't know why this change is needed, but it loo
zerny-chromium
2014/03/24 08:32:28
We can't put non-GC allocated types in members as
| |
| 158 static PassRefPtrWillBeRawPtr<EmptyType> create(EmptyType*) | 158 static PassRefPtrWillBeRawPtr<EmptyType> create(EmptyType*) |
| 159 { | 159 { |
| 160 return nullptr; | 160 return nullptr; |
| 161 } | 161 } |
| 162 }; | 162 }; |
| 163 | 163 |
| 164 typedef SyncCallbackHelper<EntryCallback, Entry*, EntrySync> EntrySyncCallbackHe lper; | 164 typedef SyncCallbackHelper<EntryCallback, Entry*, EntrySync> EntrySyncCallbackHe lper; |
| 165 typedef SyncCallbackHelper<MetadataCallback, Metadata*, Metadata> MetadataSyncCa llbackHelper; | 165 typedef SyncCallbackHelper<MetadataCallback, Metadata*, Metadata> MetadataSyncCa llbackHelper; |
| 166 typedef SyncCallbackHelper<VoidCallback, EmptyType*, EmptyType> VoidSyncCallback Helper; | 166 typedef SyncCallbackHelper<VoidCallback, EmptyType*, EmptyType> VoidSyncCallback Helper; |
| 167 typedef SyncCallbackHelper<FileSystemCallback, DOMFileSystem*, DOMFileSystemSync > FileSystemSyncCallbackHelper; | 167 typedef SyncCallbackHelper<FileSystemCallback, DOMFileSystem*, DOMFileSystemSync > FileSystemSyncCallbackHelper; |
| 168 | 168 |
| 169 } // namespace WebCore | 169 } // namespace WebCore |
| 170 | 170 |
| 171 #endif // SyncCallbackHelper_h | 171 #endif // SyncCallbackHelper_h |
| OLD | NEW |