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

Unified Diff: ui/ozone/platform/dri/dri_window_manager.cc

Issue 479713002: [Ozone-GBM] Adding NativeWindowDelegate to IPC window changes to the GPU (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix name Created 6 years, 4 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
« no previous file with comments | « ui/ozone/platform/dri/dri_window_manager.h ('k') | ui/ozone/platform/dri/gbm.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/dri/dri_window_manager.cc
diff --git a/ui/ozone/platform/dri/dri_window_manager.cc b/ui/ozone/platform/dri/dri_window_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f95cad74fdcb0fbc2f7505fd39d570c914fef3f2
--- /dev/null
+++ b/ui/ozone/platform/dri/dri_window_manager.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 "ui/ozone/platform/dri/dri_window_manager.h"
+
+namespace ui {
+
+DriWindowManager::DriWindowManager() : last_allocated_widget_(0) {
+}
+
+DriWindowManager::~DriWindowManager() {
+ DCHECK(delegate_map_.empty());
+}
+
+gfx::AcceleratedWidget DriWindowManager::NextAcceleratedWidget() {
+ // We're not using 0 since other code assumes that a 0 AcceleratedWidget is an
+ // invalid widget.
+ return ++last_allocated_widget_;
+}
+
+void DriWindowManager::AddWindowDelegate(gfx::AcceleratedWidget widget,
+ DriWindowDelegate* delegate) {
+ DCHECK(delegate_map_.find(widget) == delegate_map_.end())
+ << "Window delegate already added.";
+ delegate_map_.insert(std::make_pair(widget, delegate));
+}
+
+void DriWindowManager::RemoveWindowDelegate(gfx::AcceleratedWidget widget) {
+ WidgetToDelegateMap::iterator it = delegate_map_.find(widget);
+ DCHECK(it != delegate_map_.end())
+ << "Attempting to remove non-existing delegate.";
+
+ delegate_map_.erase(it);
+}
+
+DriWindowDelegate* DriWindowManager::GetWindowDelegate(
+ gfx::AcceleratedWidget widget) {
+ WidgetToDelegateMap::iterator it = delegate_map_.find(widget);
+ if (it != delegate_map_.end())
+ return it->second;
+
+ NOTREACHED();
+ return NULL;
+}
+
+bool DriWindowManager::HasWindowDelegate(gfx::AcceleratedWidget widget) {
+ return delegate_map_.find(widget) != delegate_map_.end();
+}
+
+} // namespace ui
« no previous file with comments | « ui/ozone/platform/dri/dri_window_manager.h ('k') | ui/ozone/platform/dri/gbm.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698