diff options
author | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-06 14:31:33 +0000 |
---|---|---|
committer | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-06 14:31:33 +0000 |
commit | 981a0a0c2b74c79da4b6b6199e09d0bb39cb7575 (patch) | |
tree | 76edb91da100f9723f040f77df78631ab3bd330f /ui/base | |
parent | 0e4c0628a942b6ed058ca55aa5dd90520e15b154 (diff) | |
download | chromium_src-981a0a0c2b74c79da4b6b6199e09d0bb39cb7575.zip chromium_src-981a0a0c2b74c79da4b6b6199e09d0bb39cb7575.tar.gz chromium_src-981a0a0c2b74c79da4b6b6199e09d0bb39cb7575.tar.bz2 |
Revert 125155 (compile failure on Linux Builder (dbg)(shared)) - gtk: Move ScopedRegion into scoped_region.{h,cc}.
R=erg@chromium.org
TBR=ben@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9595003
TBR=tfarina@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9618008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125157 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base')
-rw-r--r-- | ui/base/gtk/scoped_handle_gtk.h | 55 | ||||
-rw-r--r-- | ui/base/gtk/scoped_region.cc | 41 | ||||
-rw-r--r-- | ui/base/gtk/scoped_region.h | 40 |
3 files changed, 55 insertions, 81 deletions
diff --git a/ui/base/gtk/scoped_handle_gtk.h b/ui/base/gtk/scoped_handle_gtk.h new file mode 100644 index 0000000..4ee4ec6 --- /dev/null +++ b/ui/base/gtk/scoped_handle_gtk.h @@ -0,0 +1,55 @@ +// Copyright (c) 2011 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. + +#ifndef UI_BASE_GTK_SCOPED_HANDLE_GTK_H_ +#define UI_BASE_GTK_SCOPED_HANDLE_GTK_H_ +#pragma once + +#include <gdk/gdk.h> + +namespace ui { + +// Wraps a GdkRegion. This class provides the same methods as ScopedGDIObject in +// scoped_handle_win. +class ScopedRegion { + public: + ScopedRegion() : region_(NULL) {} + explicit ScopedRegion(GdkRegion* region) : region_(region) {} + + ~ScopedRegion() { + Close(); + } + + void Set(GdkRegion* region) { + Close(); + + region_ = region; + } + + GdkRegion* Get() { + return region_; + } + + GdkRegion* release() { + GdkRegion* region = region_; + region_ = NULL; + return region; + } + + private: + void Close() { + if (region_) { + gdk_region_destroy(region_); + region_ = NULL; + } + } + + GdkRegion* region_; + + DISALLOW_COPY_AND_ASSIGN(ScopedRegion); +}; + +} // namespace ui + +#endif // UI_BASE_GTK_SCOPED_HANDLE_GTK_H_ diff --git a/ui/base/gtk/scoped_region.cc b/ui/base/gtk/scoped_region.cc deleted file mode 100644 index 729e3c3..0000000 --- a/ui/base/gtk/scoped_region.cc +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2012 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/base/gtk/scoped_region.h" - -#include <gdk/gdk.h> - -namespace ui { - -ScopedRegion::ScopedRegion() : region_(NULL) {} - -ScopedRegion::ScopedRegion(GdkRegion* region) : region_(region) {} - -ScopedRegion::~ScopedRegion() { - Close(); -} - -void ScopedRegion::Set(GdkRegion* region) { - Close(); - region_ = region; -} - -GdkRegion* ScopedRegion::Get() { - return region_; -} - -GdkRegion* ScopedRegion::release() { - GdkRegion* region = region_; - region_ = NULL; - return region; -} - -void ScopedRegion::Close() { - if (region_) { - gdk_region_destroy(region_); - region_ = NULL; - } -} - -} // namespace ui diff --git a/ui/base/gtk/scoped_region.h b/ui/base/gtk/scoped_region.h deleted file mode 100644 index 8a6ed9d..0000000 --- a/ui/base/gtk/scoped_region.h +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) 2012 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. - -#ifndef UI_BASE_GTK_SCOPED_REGION_H_ -#define UI_BASE_GTK_SCOPED_REGION_H_ -#pragma once - -#include "base/basictypes.h" - -typedef struct _GdkRegion GdkRegion; - -namespace ui { - -// Wraps a GdkRegion. This class provides the same methods as ScopedGDIObject in -// base/win/scoped_gdi_object.h. -class ScopedRegion { - public: - ScopedRegion(); - explicit ScopedRegion(GdkRegion* region); - - ~ScopedRegion(); - - void Set(GdkRegion* region); - - GdkRegion* Get(); - - GdkRegion* release(); - - private: - void Close(); - - GdkRegion* region_; - - DISALLOW_COPY_AND_ASSIGN(ScopedRegion); -}; - -} // namespace ui - -#endif // UI_BASE_GTK_SCOPED_REGION_H_ |