OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "ios/web/public/crw_browsing_data_store.h" | 5 #import "ios/web/public/crw_browsing_data_store.h" |
6 | 6 |
7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 | 8 |
9 #include "base/ios/ios_util.h" | 9 #include "base/ios/ios_util.h" |
10 #import "base/ios/weak_nsobject.h" | 10 #import "base/ios/weak_nsobject.h" |
(...skipping 27 matching lines...) Expand all Loading... | |
38 | 38 |
39 @interface CRWBrowsingDataStore () | 39 @interface CRWBrowsingDataStore () |
40 // Returns a serial queue on which stash and restore operations can be scheduled | 40 // Returns a serial queue on which stash and restore operations can be scheduled |
41 // to be run. All stash/restore operations need to be run on the same queue | 41 // to be run. All stash/restore operations need to be run on the same queue |
42 // hence it is shared with all CRWBrowsingDataStores. | 42 // hence it is shared with all CRWBrowsingDataStores. |
43 + (NSOperationQueue*)operationQueueForStashAndRestoreOperations; | 43 + (NSOperationQueue*)operationQueueForStashAndRestoreOperations; |
44 // Returns a concurrent queue on which remove operations can be scheduled to be | 44 // Returns a concurrent queue on which remove operations can be scheduled to be |
45 // run. All remove operations need to be run on the same queue hence it is | 45 // run. All remove operations need to be run on the same queue hence it is |
46 // shared with all CRWBrowsingDataStores. | 46 // shared with all CRWBrowsingDataStores. |
47 + (NSOperationQueue*)operationQueueForRemoveOperations; | 47 + (NSOperationQueue*)operationQueueForRemoveOperations; |
48 - (instancetype)init NS_UNAVAILABLE; | 48 - (instancetype)init NS_UNAVAILABLE; |
stuartmorgan
2015/06/30 21:57:17
Doesn't NS_UNAVAILABLE only make sense in the head
shreyasv1
2015/07/07 21:42:05
Done.
| |
49 | 49 |
50 // The array of all browsing data managers. Must be accessed from the main | 50 // The array of all browsing data managers. Must be accessed from the main |
51 // thread. | 51 // thread. |
52 @property(nonatomic, readonly) NSArray* allBrowsingDataManagers; | 52 @property(nonatomic, readonly) NSArray* allBrowsingDataManagers; |
stuartmorgan
2015/06/30 21:57:17
Properties should be declared in a coherent sectio
shreyasv1
2015/07/07 21:42:05
Done.
I can't find this requirement in the style g
stuartmorgan
2015/07/09 16:33:49
http://google-styleguide.googlecode.com/svn/trunk/
shreyasv1
2015/07/09 17:18:01
It is not explicitly spelled out. Maybe it should
| |
53 // Returns an array of browsing data managers for the given |browsingDataTypes|. | 53 // Returns an array of browsing data managers for the given |browsingDataTypes|. |
54 - (NSArray*)browsingDataManagersForBrowsingDataTypes: | 54 - (NSArray*)browsingDataManagersForBrowsingDataTypes: |
55 (web::BrowsingDataTypes)browsingDataTypes; | 55 (web::BrowsingDataTypes)browsingDataTypes; |
56 // Returns the selector that needs to be performed on the | 56 // Returns the selector that needs to be performed on the |
57 // CRWBrowsingDataManagers for the |operationType|. |operationType| cannot be | 57 // CRWBrowsingDataManagers for the |operationType|. |operationType| cannot be |
58 // |NONE|. | 58 // |NONE|. |
59 - (SEL)browsingDataManagerSelectorForOperationType:(OperationType)operationType; | 59 - (SEL)browsingDataManagerSelectorForOperationType:(OperationType)operationType; |
60 // Returns the selector that needs to be performed on the | 60 // Returns the selector that needs to be performed on the |
61 // CRWBrowsingDataManagers for a REMOVE operation. | 61 // CRWBrowsingDataManagers for a REMOVE operation. |
62 - (SEL)browsingDataManagerSelectorForRemoveOperationType; | 62 - (SEL)browsingDataManagerSelectorForRemoveOperationType; |
63 | 63 |
64 // Redefined to be read-write. Must be called from the main thread. | 64 // Redefined to be read-write. Must be called from the main thread. |
65 @property(nonatomic, assign) web::BrowsingDataStoreMode mode; | 65 @property(nonatomic, assign) web::BrowsingDataStoreMode mode; |
66 // Sets the mode iff there are no more stash or restore operations that are | 66 // Sets the mode iff there are no more stash or restore operations that are |
67 // still pending. |mode| can only be either |ACTIVE| or |INACTIVE|. | 67 // still pending. |mode| can only be either |ACTIVE| or |INACTIVE|. |
68 // |handler| is called immediately (in the same runloop) with a BOOL indicating | 68 // |handler| is called immediately (in the same runloop) with a BOOL indicating |
69 // whether the mode change was successful or not. |handler| can be nil. | 69 // whether the mode change was successful or not. |handler| can be nil. |
70 - (void)finalizeChangeToMode:(web::BrowsingDataStoreMode)mode | 70 - (void)finalizeChangeToMode:(web::BrowsingDataStoreMode)mode |
71 andCallCompletionHandler:(void (^)(BOOL modeChangeWasSuccessful))handler; | 71 andCallCompletionHandler:(void (^)(BOOL modeChangeWasSuccessful))handler; |
stuartmorgan
2015/06/30 21:57:17
s/andCall/with/?
shreyasv1
2015/07/07 21:42:05
This came up in an earlier code review.
In UIKit
stuartmorgan
2015/07/09 16:33:49
When you have to invent a new naming variation, th
shreyasv1
2015/07/09 17:18:00
I actually had a BOOL return methods originally bu
| |
72 | 72 |
73 // Changes the mode of the CRWBrowsingDataStore to |mode|. This is an | 73 // Changes the mode of the CRWBrowsingDataStore to |mode|. This is an |
74 // asynchronous operation and the mode is not changed immediately. | 74 // asynchronous operation and the mode is not changed immediately. |
75 // |completionHandler| can be nil. | 75 // |completionHandler| can be nil. |
76 // |completionHandler| is called on the main thread. This block has no return | 76 // |completionHandler| is called on the main thread. This block has no return |
77 // value and takes a single BOOL argument that indicates whether or not the | 77 // value and takes a single BOOL argument that indicates whether or not the |
78 // mode change was successfully changed to |mode|. | 78 // mode change was successfully changed to |mode|. |
79 - (void)changeMode:(web::BrowsingDataStoreMode)mode | 79 - (void)changeMode:(web::BrowsingDataStoreMode)mode |
80 completionHandler:(void (^)(BOOL modeChangeWasSuccessful))completionHandler; | 80 completionHandler:(void (^)(BOOL modeChangeWasSuccessful))completionHandler; |
81 | 81 |
82 // The number of stash or restore operations that are still pending. | 82 // The number of stash or restore operations that are still pending. |
83 @property(nonatomic, assign) NSUInteger numberOfPendingStashOrRestoreOperations; | 83 @property(nonatomic, assign) NSUInteger numberOfPendingStashOrRestoreOperations; |
84 | 84 |
85 // Performs operations of type |operationType| on each of the | 85 // Performs operations of type |operationType| on each of the |
stuartmorgan
2015/06/30 21:57:17
"operations", or "an operation"? This doesn't matc
shreyasv1
2015/07/07 21:42:05
Good catch.
| |
86 // |browsingDataManagers|. |operationType| cannot be |NONE|. | 86 // |browsingDataManagers|. |operationType| cannot be |NONE|. |
87 // Precondition: There must be no web views associated with the BrowserState. | 87 // Precondition: There must be no web views associated with the BrowserState. |
88 // |completionHandler| is called on the main thread and cannot be nil. | 88 // |completionHandler| is called on the main thread and cannot be nil. |
89 - (void)performOperationWithType:(OperationType)operationType | 89 - (void)performOperationWithType:(OperationType)operationType |
90 browsingDataManagers:(NSArray*)browsingDataManagers | 90 browsingDataManagers:(NSArray*)browsingDataManagers |
91 completionHandler:(ProceduralBlock)completionHandler; | 91 completionHandler:(ProceduralBlock)completionHandler; |
92 | 92 |
93 // Creates an NSOperation that calls |selector| on all the | 93 // Creates an NSOperation that calls |selector| on all the |
94 // |browsingDataManagers|. |selector| needs to be one of the methods in | 94 // |browsingDataManagers|. |selector| needs to be one of the methods in |
95 // CRWBrowsingDataManager. The created NSOperation will have a completionBlock | 95 // CRWBrowsingDataManager. The created NSOperation will have a completionBlock |
96 // of |completionHandler|. | 96 // of |completionHandler|. |
97 - (NSOperation*) | 97 - (NSOperation*) |
98 newOperationWithBrowsingDataManagers:(NSArray*)browsingDataManagers | 98 newOperationWithBrowsingDataManagers:(NSArray*)browsingDataManagers |
stuartmorgan
2015/06/30 21:57:17
Why return a retained object? Usually methods retu
shreyasv1
2015/07/07 21:42:05
I don't this is enforced by the style guide.
But
stuartmorgan
2015/07/09 16:33:49
Being consistent with the overwhelming majority of
| |
99 selector:(SEL)selector | 99 selector:(SEL)selector |
100 completionHandler:(ProceduralBlock)completionHandler; | 100 completionHandler:(ProceduralBlock)completionHandler; |
101 // Enqueues |operation| to be run on |queue|. All operations are serialized to | 101 // Enqueues |operation| to be run on |queue|. All operations are serialized to |
102 // be run one after another. | 102 // be run one after another. |
stuartmorgan
2015/06/30 21:57:17
It's not at all obvious from the comments why ther
shreyasv1
2015/07/07 21:42:05
There are 2 different points here:
1) I have added
stuartmorgan
2015/07/09 16:33:49
But this API is a private helper method for this c
shreyasv1
2015/07/09 17:18:00
Acknowledged.
| |
103 - (void)addOperation:(NSOperation*)operation toQueue:(NSOperationQueue*)queue; | 103 - (void)addOperation:(NSOperation*)operation toQueue:(NSOperationQueue*)queue; |
104 @end | 104 @end |
105 | 105 |
106 @implementation CRWBrowsingDataStore { | 106 @implementation CRWBrowsingDataStore { |
107 web::BrowserState* _browserState; // Weak, owns this object. | 107 web::BrowserState* _browserState; // Weak, owns this object. |
108 // The delegate. | 108 // The delegate. |
109 base::WeakNSProtocol<id<CRWBrowsingDataStoreDelegate>> _delegate; | 109 base::WeakNSProtocol<id<CRWBrowsingDataStoreDelegate>> _delegate; |
110 // The mode of the CRWBrowsingDataStore. | 110 // The mode of the CRWBrowsingDataStore. |
111 web::BrowsingDataStoreMode _mode; | 111 web::BrowsingDataStoreMode _mode; |
112 // The dictionary that maps a browsing data type to its | 112 // The dictionary that maps a browsing data type to its |
113 // CRWBrowsingDataManager. | 113 // CRWBrowsingDataManager. |
114 base::scoped_nsobject<NSDictionary> _browsingDataTypeMap; | 114 base::scoped_nsobject<NSDictionary> _browsingDataTypeMap; |
115 // The last operation that was enqueued to be run. Can be stash, restore or a | 115 // The last operation that was enqueued to be run. Can be stash, restore or a |
116 // delete operation. | 116 // delete operation. |
117 base::scoped_nsobject<NSOperation> _lastDispatchedOperation; | 117 base::scoped_nsobject<NSOperation> _lastDispatchedOperation; |
118 // The last dispatched stash or restore operation that was enqueued to be run. | 118 // The last dispatched stash or restore operation that was enqueued to be run. |
119 base::scoped_nsobject<NSOperation> _lastDispatchedStashOrRestoreOperation; | 119 base::scoped_nsobject<NSOperation> _lastDispatchedStashOrRestoreOperation; |
120 // The number of stash or restore operations that are still pending. If this | 120 // The number of stash or restore operations that are still pending. If this |
stuartmorgan
2015/06/30 21:57:18
s/this//
shreyasv1
2015/07/07 21:42:05
doesn't that make value ambiguous?
The pronoun mak
stuartmorgan
2015/07/09 16:33:50
Yes, I just mis-parsed the sentence. I think what
shreyasv1
2015/07/09 17:18:00
Done.
| |
121 // value > 0 the mode of the CRWBrowsingDataStore is |CHANGING|. The mode | 121 // value > 0 the mode of the CRWBrowsingDataStore is |CHANGING|. The mode |
122 // can be made ACTIVE or INACTIVE only be set when this value is 0. | 122 // can be made ACTIVE or INACTIVE only be set when this value is 0. |
123 NSUInteger _numberOfPendingStashOrRestoreOperations; | 123 NSUInteger _numberOfPendingStashOrRestoreOperations; |
124 } | 124 } |
125 | 125 |
126 + (NSOperationQueue*)operationQueueForStashAndRestoreOperations { | 126 + (NSOperationQueue*)operationQueueForStashAndRestoreOperations { |
127 static dispatch_once_t onceToken = 0; | 127 static dispatch_once_t onceToken = 0; |
128 static NSOperationQueue* operationQueueForStashAndRestoreOperations = nil; | 128 static NSOperationQueue* operationQueueForStashAndRestoreOperations = nil; |
129 dispatch_once(&onceToken, ^{ | 129 dispatch_once(&onceToken, ^{ |
130 operationQueueForStashAndRestoreOperations = | 130 operationQueueForStashAndRestoreOperations = |
131 [[NSOperationQueue alloc] init]; | 131 [[NSOperationQueue alloc] init]; |
132 [operationQueueForStashAndRestoreOperations | 132 [operationQueueForStashAndRestoreOperations |
133 setMaxConcurrentOperationCount:1U]; | 133 setMaxConcurrentOperationCount:1U]; |
134 if (base::ios::IsRunningOnIOS8OrLater()) { | 134 if (base::ios::IsRunningOnIOS8OrLater()) { |
135 [operationQueueForStashAndRestoreOperations | 135 [operationQueueForStashAndRestoreOperations |
136 setQualityOfService:NSQualityOfServiceUserInteractive]; | 136 setQualityOfService:NSQualityOfServiceUserInteractive]; |
stuartmorgan
2015/06/30 21:57:17
Why interactive? From the descriptions, NSQualityO
shreyasv1
2015/07/07 21:42:05
|STASH|, |RESTORE| operations are the core bits th
stuartmorgan
2015/07/09 16:33:49
I don't understand how the second part of that fol
shreyasv1
2015/07/09 17:18:00
Done. Also added this to the high level queue desc
| |
137 } | 137 } |
138 }); | 138 }); |
139 return operationQueueForStashAndRestoreOperations; | 139 return operationQueueForStashAndRestoreOperations; |
140 } | 140 } |
141 | 141 |
142 + (NSOperationQueue*)operationQueueForRemoveOperations { | 142 + (NSOperationQueue*)operationQueueForRemoveOperations { |
143 static dispatch_once_t onceToken = 0; | 143 static dispatch_once_t onceToken = 0; |
144 static NSOperationQueue* operationQueueForRemoveOperations = nil; | 144 static NSOperationQueue* operationQueueForRemoveOperations = nil; |
145 dispatch_once(&onceToken, ^{ | 145 dispatch_once(&onceToken, ^{ |
146 operationQueueForRemoveOperations = [[NSOperationQueue alloc] init]; | 146 operationQueueForRemoveOperations = [[NSOperationQueue alloc] init]; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
192 return result; | 192 return result; |
193 } | 193 } |
194 | 194 |
195 | 195 |
196 - (NSArray*)allBrowsingDataManagers { | 196 - (NSArray*)allBrowsingDataManagers { |
197 DCHECK([NSThread isMainThread]); | 197 DCHECK([NSThread isMainThread]); |
198 return [_browsingDataTypeMap allValues]; | 198 return [_browsingDataTypeMap allValues]; |
199 } | 199 } |
200 | 200 |
201 - (NSArray*)browsingDataManagersForBrowsingDataTypes: | 201 - (NSArray*)browsingDataManagersForBrowsingDataTypes: |
202 (web::BrowsingDataTypes)browsingDataTypes { | 202 (web::BrowsingDataTypes)browsingDataTypes { |
stuartmorgan
2015/06/30 21:57:17
Only indent 4
shreyasv1
2015/07/07 21:42:05
git cl format artifact.
| |
203 __block NSMutableArray* result = [NSMutableArray array]; | 203 __block NSMutableArray* result = [NSMutableArray array]; |
204 [_browsingDataTypeMap | 204 [_browsingDataTypeMap |
205 enumerateKeysAndObjectsUsingBlock:^(NSNumber* dataType, | 205 enumerateKeysAndObjectsUsingBlock:^(NSNumber* dataType, |
206 id<CRWBrowsingDataManager> manager, | 206 id<CRWBrowsingDataManager> manager, |
207 BOOL*) { | 207 BOOL*) { |
208 if ([dataType unsignedIntegerValue] & browsingDataTypes) { | 208 if ([dataType unsignedIntegerValue] & browsingDataTypes) { |
209 [result addObject:manager]; | 209 [result addObject:manager]; |
210 } | 210 } |
211 }]; | 211 }]; |
212 return result; | 212 return result; |
213 } | 213 } |
214 | 214 |
215 - (id<CRWBrowsingDataStoreDelegate>)delegate { | 215 - (id<CRWBrowsingDataStoreDelegate>)delegate { |
216 return _delegate; | 216 return _delegate; |
217 } | 217 } |
218 | 218 |
219 - (void)setDelegate:(id<CRWBrowsingDataStoreDelegate>)delegate { | 219 - (void)setDelegate:(id<CRWBrowsingDataStoreDelegate>)delegate { |
220 _delegate.reset(delegate); | 220 _delegate.reset(delegate); |
stuartmorgan
2015/06/30 21:57:17
Where is the ownership coming from? This looks lik
shreyasv1
2015/07/07 21:42:05
How?
The ownership semantics (weak) are documented
stuartmorgan
2015/07/09 16:33:49
Sigh. I hate that the Weak* family uses reset(), f
shreyasv1
2015/07/09 17:18:00
Acknowledged.
| |
221 } | 221 } |
222 | 222 |
223 - (SEL)browsingDataManagerSelectorForOperationType: | 223 - (SEL)browsingDataManagerSelectorForOperationType: |
224 (OperationType)operationType { | 224 (OperationType)operationType { |
stuartmorgan
2015/06/30 21:57:17
Only indent 4
shreyasv1
2015/07/07 21:42:05
Done.
| |
225 switch (operationType) { | 225 switch (operationType) { |
226 case NONE: | 226 case NONE: |
227 NOTREACHED(); | 227 NOTREACHED(); |
228 return nullptr; | 228 return nullptr; |
stuartmorgan
2015/06/30 21:57:17
Usually the invalid option goes at the end.
shreyasv1
2015/07/07 21:42:05
This one is tricky.
I feel that it is natural to r
| |
229 case STASH: | 229 case STASH: |
230 return @selector(stashData); | 230 return @selector(stashData); |
231 case RESTORE: | 231 case RESTORE: |
232 return @selector(restoreData); | 232 return @selector(restoreData); |
233 case REMOVE: | 233 case REMOVE: |
234 return [self browsingDataManagerSelectorForRemoveOperationType]; | 234 return [self browsingDataManagerSelectorForRemoveOperationType]; |
235 }; | 235 }; |
236 NOTREACHED(); | 236 NOTREACHED(); |
237 return nullptr; | 237 return nullptr; |
stuartmorgan
2015/06/30 21:57:17
Does the compiler actually require this if you hav
shreyasv1
2015/07/07 21:42:05
No, removed.
| |
238 } | 238 } |
239 | 239 |
240 - (SEL)browsingDataManagerSelectorForRemoveOperationType { | 240 - (SEL)browsingDataManagerSelectorForRemoveOperationType { |
241 if (self.mode == web::ACTIVE) { | 241 if (self.mode == web::ACTIVE) { |
242 return @selector(removeDataAtCanonicalPath); | 242 return @selector(removeDataAtCanonicalPath); |
243 } | 243 } |
244 if (self.mode == web::INACTIVE) { | 244 if (self.mode == web::INACTIVE) { |
245 return @selector(removeDataAtStashPath); | 245 return @selector(removeDataAtStashPath); |
246 } | 246 } |
247 DCHECK(_lastDispatchedStashOrRestoreOperation); | 247 DCHECK(_lastDispatchedStashOrRestoreOperation); |
stuartmorgan
2015/06/30 21:57:17
Seems like a short comment introducing what this w
shreyasv1
2015/07/07 21:42:05
Done.
| |
248 NSString* lastDispatchedStashOrRestoreOperationName = | 248 NSString* lastDispatchedStashOrRestoreOperationName = |
249 [_lastDispatchedStashOrRestoreOperation name]; | 249 [_lastDispatchedStashOrRestoreOperation name]; |
250 if ([lastDispatchedStashOrRestoreOperationName | 250 if ([lastDispatchedStashOrRestoreOperationName |
251 isEqual:kRestoreOperationName]) { | 251 isEqual:kRestoreOperationName]) { |
252 return @selector(removeDataAtCanonicalPath); | 252 return @selector(removeDataAtCanonicalPath); |
253 } | 253 } |
254 if ([lastDispatchedStashOrRestoreOperationName isEqual:kStashOperationName]) { | 254 if ([lastDispatchedStashOrRestoreOperationName isEqual:kStashOperationName]) { |
255 return @selector(removeDataAtStashPath); | 255 return @selector(removeDataAtStashPath); |
256 } | 256 } |
257 NOTREACHED(); | 257 NOTREACHED(); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
356 web::BrowsingDataStoreMakeActivePolicy makeActivePolicy = | 356 web::BrowsingDataStoreMakeActivePolicy makeActivePolicy = |
357 [_delegate decideMakeActiveOperationPolicyForBrowsingDataStore:self]; | 357 [_delegate decideMakeActiveOperationPolicyForBrowsingDataStore:self]; |
358 operationType = (makeActivePolicy == web::ADOPT) ? REMOVE : RESTORE; | 358 operationType = (makeActivePolicy == web::ADOPT) ? REMOVE : RESTORE; |
359 } else { | 359 } else { |
360 // By default a |STASH| operation is performed when the mode is changed to | 360 // By default a |STASH| operation is performed when the mode is changed to |
361 // |INACTIVE|. | 361 // |INACTIVE|. |
362 operationType = STASH; | 362 operationType = STASH; |
363 web::BrowsingDataStoreMakeInactivePolicy makeInactivePolicy = | 363 web::BrowsingDataStoreMakeInactivePolicy makeInactivePolicy = |
364 [_delegate decideMakeInactiveOperationPolicyForBrowsingDataStore:self]; | 364 [_delegate decideMakeInactiveOperationPolicyForBrowsingDataStore:self]; |
365 operationType = (makeInactivePolicy == web::DELETE) ? REMOVE : STASH; | 365 operationType = (makeInactivePolicy == web::DELETE) ? REMOVE : STASH; |
366 } | 366 } |
stuartmorgan
2015/06/30 21:57:17
Consider making the whole block from operationType
shreyasv1
2015/07/07 21:42:05
Done.
| |
367 DCHECK_NE(NONE, operationType); | 367 DCHECK_NE(NONE, operationType); |
368 [self performOperationWithType:operationType | 368 [self performOperationWithType:operationType |
369 browsingDataManagers:[self allBrowsingDataManagers] | 369 browsingDataManagers:[self allBrowsingDataManagers] |
370 completionHandler:completionHandlerAfterPerformingOperation]; | 370 completionHandler:completionHandlerAfterPerformingOperation]; |
371 } | 371 } |
372 | 372 |
373 - (void)removeDataOfTypes:(web::BrowsingDataTypes)browsingDataTypes | 373 - (void)removeDataOfTypes:(web::BrowsingDataTypes)browsingDataTypes |
374 completionHandler:(ProceduralBlock)completionHandler { | 374 completionHandler:(ProceduralBlock)completionHandler { |
375 DCHECK([NSThread isMainThread]); | 375 DCHECK([NSThread isMainThread]); |
376 | 376 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
433 | 433 |
434 NSOperationQueue* queue = nil; | 434 NSOperationQueue* queue = nil; |
435 switch (operationType) { | 435 switch (operationType) { |
436 case STASH: | 436 case STASH: |
437 case RESTORE: | 437 case RESTORE: |
438 queue = [CRWBrowsingDataStore operationQueueForStashAndRestoreOperations]; | 438 queue = [CRWBrowsingDataStore operationQueueForStashAndRestoreOperations]; |
439 break; | 439 break; |
440 case REMOVE: | 440 case REMOVE: |
441 queue = [CRWBrowsingDataStore operationQueueForRemoveOperations]; | 441 queue = [CRWBrowsingDataStore operationQueueForRemoveOperations]; |
442 break; | 442 break; |
443 default: | 443 default: |
stuartmorgan
2015/06/30 21:57:17
Why include a default here (vs NONE)? If someone a
shreyasv1
2015/07/07 21:42:05
Good catch.
| |
444 NOTREACHED(); | 444 NOTREACHED(); |
445 break; | 445 break; |
446 } | 446 } |
447 | 447 |
448 [self addOperation:operation toQueue:queue]; | 448 [self addOperation:operation toQueue:queue]; |
449 } | 449 } |
450 | 450 |
451 - (NSOperation*) | 451 - (NSOperation*) |
452 newOperationWithBrowsingDataManagers:(NSArray*)browsingDataManagers | 452 newOperationWithBrowsingDataManagers:(NSArray*)browsingDataManagers |
453 selector:(SEL)selector | 453 selector:(SEL)selector |
(...skipping 16 matching lines...) Expand all Loading... | |
470 DCHECK(queue); | 470 DCHECK(queue); |
471 | 471 |
472 if (_lastDispatchedOperation) { | 472 if (_lastDispatchedOperation) { |
473 [operation addDependency:_lastDispatchedOperation]; | 473 [operation addDependency:_lastDispatchedOperation]; |
474 } | 474 } |
475 _lastDispatchedOperation.reset([operation retain]); | 475 _lastDispatchedOperation.reset([operation retain]); |
476 [queue addOperation:operation]; | 476 [queue addOperation:operation]; |
477 } | 477 } |
478 | 478 |
479 @end | 479 @end |
480 | |
OLD | NEW |