Chromium Code Reviews| 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; | |
|
rohitrao (ping after 24h)
2015/06/10 16:18:22
Should this be in the .h file?
justincohen
2015/06/10 16:33:36
Why? It doesn't need to be?
| |
| 48 | 49 |
| 49 // 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 |
| 50 // thread. | 51 // thread. |
| 51 @property(nonatomic, readonly) NSArray* allBrowsingDataManagers; | 52 @property(nonatomic, readonly) NSArray* allBrowsingDataManagers; |
| 52 // Returns an array of browsing data managers for the given |browsingDataTypes|. | 53 // Returns an array of browsing data managers for the given |browsingDataTypes|. |
| 53 - (NSArray*)browsingDataManagersForBrowsingDataTypes: | 54 - (NSArray*)browsingDataManagersForBrowsingDataTypes: |
| 54 (web::BrowsingDataTypes)browsingDataTypes; | 55 (web::BrowsingDataTypes)browsingDataTypes; |
| 55 // Returns the selector that needs to be performed on the | 56 // Returns the selector that needs to be performed on the |
| 56 // CRWBrowsingDataManagers for the |operationType|. |operationType| cannot be | 57 // CRWBrowsingDataManagers for the |operationType|. |operationType| cannot be |
| 57 // |NONE|. | 58 // |NONE|. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 // delete operation. | 116 // delete operation. |
| 116 base::scoped_nsobject<NSOperation> _lastDispatchedOperation; | 117 base::scoped_nsobject<NSOperation> _lastDispatchedOperation; |
| 117 // 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. |
| 118 base::scoped_nsobject<NSOperation> _lastDispatchedStashOrRestoreOperation; | 119 base::scoped_nsobject<NSOperation> _lastDispatchedStashOrRestoreOperation; |
| 119 // 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 |
| 120 // value > 0 the mode of the CRWBrowsingDataStore is |CHANGING|. The mode | 121 // value > 0 the mode of the CRWBrowsingDataStore is |CHANGING|. The mode |
| 121 // 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. |
| 122 NSUInteger _numberOfPendingStashOrRestoreOperations; | 123 NSUInteger _numberOfPendingStashOrRestoreOperations; |
| 123 } | 124 } |
| 124 | 125 |
| 126 - (instancetype)init { | |
| 127 NOTREACHED(); | |
| 128 return nil; | |
| 129 } | |
| 130 | |
| 125 + (NSOperationQueue*)operationQueueForStashAndRestoreOperations { | 131 + (NSOperationQueue*)operationQueueForStashAndRestoreOperations { |
| 126 static dispatch_once_t onceToken = 0; | 132 static dispatch_once_t onceToken = 0; |
| 127 static NSOperationQueue* operationQueueForStashAndRestoreOperations = nil; | 133 static NSOperationQueue* operationQueueForStashAndRestoreOperations = nil; |
| 128 dispatch_once(&onceToken, ^{ | 134 dispatch_once(&onceToken, ^{ |
| 129 operationQueueForStashAndRestoreOperations = | 135 operationQueueForStashAndRestoreOperations = |
| 130 [[NSOperationQueue alloc] init]; | 136 [[NSOperationQueue alloc] init]; |
| 131 [operationQueueForStashAndRestoreOperations | 137 [operationQueueForStashAndRestoreOperations |
| 132 setMaxConcurrentOperationCount:1U]; | 138 setMaxConcurrentOperationCount:1U]; |
| 133 if (base::ios::IsRunningOnIOS8OrLater()) { | 139 if (base::ios::IsRunningOnIOS8OrLater()) { |
| 134 [operationQueueForStashAndRestoreOperations | 140 [operationQueueForStashAndRestoreOperations |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 464 DCHECK(queue); | 470 DCHECK(queue); |
| 465 | 471 |
| 466 if (_lastDispatchedOperation) { | 472 if (_lastDispatchedOperation) { |
| 467 [operation addDependency:_lastDispatchedOperation]; | 473 [operation addDependency:_lastDispatchedOperation]; |
| 468 } | 474 } |
| 469 _lastDispatchedOperation.reset([operation retain]); | 475 _lastDispatchedOperation.reset([operation retain]); |
| 470 [queue addOperation:operation]; | 476 [queue addOperation:operation]; |
| 471 } | 477 } |
| 472 | 478 |
| 473 @end | 479 @end |
| OLD | NEW |