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

Side by Side Diff: content/renderer/screen_orientation/screen_orientation_dispatcher.cc

Issue 2480293004: Mandate unique_ptr for base::IDMap in IDMapOwnPointer mode. (Closed)
Patch Set: Fix typo breaking a bunch of trybot builds, oops Created 4 years, 1 month 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 #include "content/renderer/screen_orientation/screen_orientation_dispatcher.h" 5 #include "content/renderer/screen_orientation/screen_orientation_dispatcher.h"
6 6
7 #include <memory>
8
7 #include "content/common/screen_orientation_messages.h" 9 #include "content/common/screen_orientation_messages.h"
8 10
9 namespace content { 11 namespace content {
10 12
11 ScreenOrientationDispatcher::ScreenOrientationDispatcher( 13 ScreenOrientationDispatcher::ScreenOrientationDispatcher(
12 RenderFrame* render_frame) 14 RenderFrame* render_frame)
13 : RenderFrameObserver(render_frame) { 15 : RenderFrameObserver(render_frame) {
14 } 16 }
15 17
16 ScreenOrientationDispatcher::~ScreenOrientationDispatcher() { 18 ScreenOrientationDispatcher::~ScreenOrientationDispatcher() {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 void ScreenOrientationDispatcher::CancelPendingLocks() { 59 void ScreenOrientationDispatcher::CancelPendingLocks() {
58 for (CallbackMap::Iterator<blink::WebLockOrientationCallback> 60 for (CallbackMap::Iterator<blink::WebLockOrientationCallback>
59 iterator(&pending_callbacks_); !iterator.IsAtEnd(); iterator.Advance()) { 61 iterator(&pending_callbacks_); !iterator.IsAtEnd(); iterator.Advance()) {
60 iterator.GetCurrentValue()->onError(blink::WebLockOrientationErrorCanceled); 62 iterator.GetCurrentValue()->onError(blink::WebLockOrientationErrorCanceled);
61 pending_callbacks_.Remove(iterator.GetCurrentKey()); 63 pending_callbacks_.Remove(iterator.GetCurrentKey());
62 } 64 }
63 } 65 }
64 66
65 void ScreenOrientationDispatcher::lockOrientation( 67 void ScreenOrientationDispatcher::lockOrientation(
66 blink::WebScreenOrientationLockType orientation, 68 blink::WebScreenOrientationLockType orientation,
67 blink::WebLockOrientationCallback* callback) { 69 blink::WebLockOrientationCallback* callback) {
danakj 2016/11/18 00:15:33 same
rlanday 2016/11/22 18:22:33 There's a unit test that creates something called
rlanday 2016/11/22 19:08:04 note: I ended up just making the destructor public
68 CancelPendingLocks(); 70 CancelPendingLocks();
69 71
70 int request_id = pending_callbacks_.Add(callback); 72 int request_id = pending_callbacks_.Add(
73 std::unique_ptr<blink::WebLockOrientationCallback>(callback));
71 Send(new ScreenOrientationHostMsg_LockRequest( 74 Send(new ScreenOrientationHostMsg_LockRequest(
72 routing_id(), orientation, request_id)); 75 routing_id(), orientation, request_id));
73 } 76 }
74 77
75 void ScreenOrientationDispatcher::unlockOrientation() { 78 void ScreenOrientationDispatcher::unlockOrientation() {
76 CancelPendingLocks(); 79 CancelPendingLocks();
77 Send(new ScreenOrientationHostMsg_Unlock(routing_id())); 80 Send(new ScreenOrientationHostMsg_Unlock(routing_id()));
78 } 81 }
79 82
80 } // namespace content 83 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698