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

Unified Diff: ui/ozone/platform/dri/native_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: . 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
Index: ui/ozone/platform/dri/native_window_manager.cc
diff --git a/ui/ozone/platform/dri/native_window_manager.cc b/ui/ozone/platform/dri/native_window_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4364b21ec293336a9eaf614d94d7f3609a9f3f3b
--- /dev/null
+++ b/ui/ozone/platform/dri/native_window_manager.cc
@@ -0,0 +1,53 @@
+// 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/native_window_manager.h"
+
+namespace ui {
+
+NativeWindowManager::NativeWindowManager() : allocated_widgets_(0) {
+}
+
+NativeWindowManager::~NativeWindowManager() {
+}
+
+gfx::AcceleratedWidget NativeWindowManager::AllocateAcceleratedWidget() {
+ // We're not using 0 since other code assumes that a 0 AcceleratedWidget is an
+ // invalid widget.
+ return ++allocated_widgets_;
+}
+
+void NativeWindowManager::AddNativeWindowDelegate(
+ gfx::AcceleratedWidget widget,
+ NativeWindowDelegate* delegate) {
+ DCHECK(delegate_map_.find(widget) == delegate_map_.end())
+ << "Surface delegate already added.";
spang 2014/08/18 19:31:30 surface delegate?
+ delegate_map_.insert(std::make_pair(widget, delegate));
+}
+
+void NativeWindowManager::RemoveNativeWindowDelegate(
+ 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);
+}
+
+NativeWindowDelegate* NativeWindowManager::GetNativeWindowDelegate(
+ gfx::AcceleratedWidget widget) {
+ WidgetToDelegateMap::iterator it = delegate_map_.find(widget);
+ if (it != delegate_map_.end())
+ return it->second;
+
+ NOTREACHED();
+ return NULL;
+}
+
+bool NativeWindowManager::HasNativeWindowDelegate(
+ gfx::AcceleratedWidget widget) {
+ return delegate_map_.find(widget) != delegate_map_.end();
+}
+
+} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698