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

Unified Diff: content/browser/renderer_host/compositor_resize_lock.cc

Issue 2773433003: Fix CompositorResizeLock to do something. (Closed)
Patch Set: resizelock: observer-rebase Created 3 years, 9 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/browser/renderer_host/compositor_resize_lock.cc
diff --git a/content/browser/renderer_host/compositor_resize_lock.cc b/content/browser/renderer_host/compositor_resize_lock.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a6dfd2b5d9a0fb8a707298404b6382cb70e135b2
--- /dev/null
+++ b/content/browser/renderer_host/compositor_resize_lock.cc
@@ -0,0 +1,51 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/renderer_host/compositor_resize_lock.h"
+
+#include "base/trace_event/trace_event.h"
+#include "content/public/browser/browser_thread.h"
+#include "ui/compositor/compositor.h"
+
+namespace content {
+
+CompositorResizeLock::CompositorResizeLock(CompositorResizeLockClient* client,
+ const gfx::Size& new_size)
+ : client_(client), expected_size_(new_size) {
+ TRACE_EVENT_ASYNC_BEGIN2("ui", "CompositorResizeLock", this, "width",
+ expected_size().width(), "height",
+ expected_size().height());
+}
+
+CompositorResizeLock::~CompositorResizeLock() {
+ compositor_lock_ = nullptr;
+ if (client_)
+ client_->CompositorResizeLockEnded();
+
+ TRACE_EVENT_ASYNC_END2("ui", "CompositorResizeLock", this, "width",
+ expected_size().width(), "height",
+ expected_size().height());
+}
+
+bool CompositorResizeLock::Lock() {
+ if (unlocked_ || compositor_lock_)
+ return false;
+ compositor_lock_ = client_->GetCompositorLock(this);
+ return true;
+}
+
+void CompositorResizeLock::UnlockCompositor() {
+ unlocked_ = true;
+ compositor_lock_ = nullptr;
+}
+
+void CompositorResizeLock::CompositorLockTimedOut() {
+ UnlockCompositor();
+ if (client_) {
+ client_->CompositorResizeLockEnded();
+ client_ = nullptr;
+ }
+}
+
+} // namespace content
« no previous file with comments | « content/browser/renderer_host/compositor_resize_lock.h ('k') | content/browser/renderer_host/compositor_resize_lock_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698