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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/ozone/platform/dri/native_window_manager.h"
6
7 namespace ui {
8
9 NativeWindowManager::NativeWindowManager() : allocated_widgets_(0) {
10 }
11
12 NativeWindowManager::~NativeWindowManager() {
13 }
14
15 gfx::AcceleratedWidget NativeWindowManager::AllocateAcceleratedWidget() {
16 // We're not using 0 since other code assumes that a 0 AcceleratedWidget is an
17 // invalid widget.
18 return ++allocated_widgets_;
19 }
20
21 void NativeWindowManager::AddNativeWindowDelegate(
22 gfx::AcceleratedWidget widget,
23 NativeWindowDelegate* delegate) {
24 DCHECK(delegate_map_.find(widget) == delegate_map_.end())
25 << "Surface delegate already added.";
26 delegate_map_.insert(std::make_pair(widget, delegate));
27 }
28
29 void NativeWindowManager::RemoveNativeWindowDelegate(
30 gfx::AcceleratedWidget widget) {
31 std::map<gfx::AcceleratedWidget, NativeWindowDelegate*>::iterator it =
32 delegate_map_.find(widget);
33 DCHECK(it != delegate_map_.end())
34 << "Attempting to remove non-existing delegate.";
35
36 delegate_map_.erase(it);
37 }
38
39 NativeWindowDelegate* NativeWindowManager::GetNativeWindowDelegate(
40 gfx::AcceleratedWidget widget) {
41 std::map<gfx::AcceleratedWidget, NativeWindowDelegate*>::iterator it =
42 delegate_map_.find(widget);
43 if (it != delegate_map_.end())
44 return it->second;
45
46 NOTREACHED();
47 return NULL;
48 }
49
50 bool NativeWindowManager::HasNativeWindowDelegate(
51 gfx::AcceleratedWidget widget) {
52 return delegate_map_.find(widget) != delegate_map_.end();
53 }
54
55 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698