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

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.";
spang 2014/08/18 19:31:30 surface delegate?
26 delegate_map_.insert(std::make_pair(widget, delegate));
27 }
28
29 void NativeWindowManager::RemoveNativeWindowDelegate(
30 gfx::AcceleratedWidget widget) {
31 WidgetToDelegateMap::iterator it = delegate_map_.find(widget);
32 DCHECK(it != delegate_map_.end())
33 << "Attempting to remove non-existing delegate.";
34
35 delegate_map_.erase(it);
36 }
37
38 NativeWindowDelegate* NativeWindowManager::GetNativeWindowDelegate(
39 gfx::AcceleratedWidget widget) {
40 WidgetToDelegateMap::iterator it = delegate_map_.find(widget);
41 if (it != delegate_map_.end())
42 return it->second;
43
44 NOTREACHED();
45 return NULL;
46 }
47
48 bool NativeWindowManager::HasNativeWindowDelegate(
49 gfx::AcceleratedWidget widget) {
50 return delegate_map_.find(widget) != delegate_map_.end();
51 }
52
53 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698