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

Unified Diff: content/renderer/screen_orientation/mock_screen_orientation_controller.cc

Issue 300063012: Make async methods UpdateLock() and ResetLock() in MockScreenOrientationController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix clang build. Created 6 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/screen_orientation/mock_screen_orientation_controller.cc
diff --git a/content/renderer/screen_orientation/mock_screen_orientation_controller.cc b/content/renderer/screen_orientation/mock_screen_orientation_controller.cc
index d16bc74e38d484a85ae12d069d94b877f7bbdace..c475ad9c0db7b7695f8f96ed7bc9059339111f6c 100644
--- a/content/renderer/screen_orientation/mock_screen_orientation_controller.cc
+++ b/content/renderer/screen_orientation/mock_screen_orientation_controller.cc
@@ -4,7 +4,9 @@
#include "content/renderer/screen_orientation/mock_screen_orientation_controller.h"
+#include "base/bind.h"
#include "base/logging.h"
+#include "base/message_loop/message_loop.h"
#include "third_party/WebKit/public/platform/WebScreenOrientationListener.h"
namespace content {
@@ -14,6 +16,9 @@ MockScreenOrientationController::MockScreenOrientationController()
device_orientation_(blink::WebScreenOrientationPortraitPrimary),
current_orientation_(blink::WebScreenOrientationPortraitPrimary),
listener_(NULL) {
+ // Since MockScreenOrientationController is held by LazyInstance reference,
+ // add this ref for it.
+ AddRef();
}
void MockScreenOrientationController::SetListener(
@@ -29,6 +34,14 @@ void MockScreenOrientationController::ResetData() {
void MockScreenOrientationController::UpdateLock(
blink::WebScreenOrientationLockType lock) {
+ LOG(ERROR) << "MockScreenOrientationController::UpdateLock()";
Inactive 2014/05/28 11:49:39 I think you meant to remove this logging?
ostap 2014/05/28 14:40:21 Done.
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&MockScreenOrientationController::UpdateLockSync, this, lock));
+}
+void MockScreenOrientationController::UpdateLockSync(
+ blink::WebScreenOrientationLockType lock) {
+ LOG(ERROR) << "MockScreenOrientationController::UpdateLockSync()";
Inactive 2014/05/28 11:49:39 ditto.
ostap 2014/05/28 14:40:21 Done.
DCHECK(lock != blink::WebScreenOrientationLockDefault);
current_lock_ = lock;
if (!IsOrientationAllowedByCurrentLock(current_orientation_))
@@ -36,6 +49,12 @@ void MockScreenOrientationController::UpdateLock(
}
void MockScreenOrientationController::ResetLock() {
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&MockScreenOrientationController::ResetLockSync, this));
+}
+
+void MockScreenOrientationController::ResetLockSync() {
bool will_screen_orientation_need_updating =
!IsOrientationAllowedByCurrentLock(device_orientation_);
current_lock_ = blink::WebScreenOrientationLockDefault;

Powered by Google App Engine
This is Rietveld 408576698