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

Side by Side Diff: ios/chrome/browser/web/dom_altering_lock.h

Issue 2853443002: Switch SupportsUserData uses to use unique_ptr. (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef IOS_CHROME_BROWSER_WEB_DOM_ALTERING_LOCK_H_ 5 #ifndef IOS_CHROME_BROWSER_WEB_DOM_ALTERING_LOCK_H_
6 #define IOS_CHROME_BROWSER_WEB_DOM_ALTERING_LOCK_H_ 6 #define IOS_CHROME_BROWSER_WEB_DOM_ALTERING_LOCK_H_
7 7
8 #include "base/ios/block_types.h" 8 #include "base/ios/block_types.h"
9 #import "base/ios/weak_nsobject.h" 9 #import "base/ios/weak_nsobject.h"
10 #include "ios/web/public/web_state/web_state_user_data.h" 10 #include "ios/web/public/web_state/web_state_user_data.h"
(...skipping 23 matching lines...) Expand all
34 // Method called when another class wants to acquire the lock. 34 // Method called when another class wants to acquire the lock.
35 // The class must restore the DOM tree, call DOMAlteringLock::Release() and then 35 // The class must restore the DOM tree, call DOMAlteringLock::Release() and then
36 // |completionHandler|. 36 // |completionHandler|.
37 - (void)releaseDOMLockWithCompletionHandler:(ProceduralBlock)completionHandler; 37 - (void)releaseDOMLockWithCompletionHandler:(ProceduralBlock)completionHandler;
38 38
39 @end 39 @end
40 40
41 class DOMAlteringLock : public web::WebStateUserData<DOMAlteringLock> { 41 class DOMAlteringLock : public web::WebStateUserData<DOMAlteringLock> {
42 public: 42 public:
43 DOMAlteringLock(web::WebState* web_state); 43 DOMAlteringLock(web::WebState* web_state);
44 ~DOMAlteringLock() override;
44 45
45 // This method must be called before altering the DOM of the page. This will 46 // This method must be called before altering the DOM of the page. This will
46 // ensure that only one class tries to alter the page at a time. 47 // ensure that only one class tries to alter the page at a time.
47 // The completion handler is called with YES if the lock was acquired, or NO 48 // The completion handler is called with YES if the lock was acquired, or NO
48 // if it could not. 49 // if it could not.
49 // This method must be called on the UI thread. 50 // This method must be called on the UI thread.
50 void Acquire(id<DOMAltering> feature, ProceduralBlockWithBool lockAction); 51 void Acquire(id<DOMAltering> feature, ProceduralBlockWithBool lockAction);
51 52
52 // Releases the lock on the DOM tree. 53 // Releases the lock on the DOM tree.
53 // The lock is always released, even if it was acquired multiple times. 54 // The lock is always released, even if it was acquired multiple times.
54 // This method must be called on the UI thread. 55 // This method must be called on the UI thread.
55 void Release(id<DOMAltering> feature); 56 void Release(id<DOMAltering> feature);
56 57
57 private: 58 private:
58 // DOMAltering object currently having the lock. 59 // DOMAltering object currently having the lock.
59 base::WeakNSProtocol<id<DOMAltering>> current_dom_altering_feature_; 60 base::WeakNSProtocol<id<DOMAltering>> current_dom_altering_feature_;
60
61 ~DOMAlteringLock() override;
62 }; 61 };
63 62
64 #endif // IOS_CHROME_BROWSER_WEB_DOM_ALTERING_LOCK_H_ 63 #endif // IOS_CHROME_BROWSER_WEB_DOM_ALTERING_LOCK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698