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

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

Issue 208313010: Replace raw pointers to GC allocated objects by members in stack allocated objects. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Make Dictionary allow_only_inline_alloc Created 6 years, 9 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 | 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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> {
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
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleResolverState.cpp ('k') | Source/modules/speech/SpeechRecognitionEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698