diff options
-rw-r--r-- | base/base.gypi | 1 | ||||
-rw-r--r-- | base/move.h | 55 | ||||
-rw-r--r-- | chrome/browser/chromeos/notifications/system_notification.cc | 21 | ||||
-rw-r--r-- | chrome/browser/chromeos/notifications/system_notification.h | 8 |
4 files changed, 15 insertions, 70 deletions
diff --git a/base/base.gypi b/base/base.gypi index fb4732c..78c97aa 100644 --- a/base/base.gypi +++ b/base/base.gypi @@ -149,7 +149,6 @@ 'metrics/stats_table.h', 'mime_util.h', 'mime_util_xdg.cc', - 'move.h', 'native_library.h', 'native_library_linux.cc', 'native_library_mac.mm', diff --git a/base/move.h b/base/move.h deleted file mode 100644 index 118eb0a..0000000 --- a/base/move.h +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2010 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 BASE_MOVE_H_ -#define BASE_MOVE_H_ -#pragma once - -#include <algorithm> - -namespace base { - -// The move function provides a functional form of swap to move a swappable -// value leverage the compiler return value optimization and avoiding copy. -// -// The type being moved must have an efficient swap() and be default -// contructable and copyable. -// -// C++0x will contain an std::move() function that makes use of rvalue -// references to achieve the same result. When std::move() is available, it -// can replace base::move(). -// -// For example, the following code will not produce any copies of the string. -// -// std::string f() { -// std::string result("Hello World"); -// return result; -// } -// -// class Class { -// public: -// Class(std::string x) // Pass sink argument by value -// : m_(move(x)); // Move x into m_ -// private: -// std::string m_; -// }; -// -// int main() { -// Class x(f()); // the result string of f() is allocated as the temp argument -// // to x() and then swapped into the member m_. No Strings -// // are copied by this call. -// ... - -template <typename T> // T models Regular -T move(T& x) { // NOLINT : Non-const ref for standard library conformance - using std::swap; - T result; - swap(x, result); - return result; -} - -} // namespace base - -#endif // BASE_MOVE_H_ - diff --git a/chrome/browser/chromeos/notifications/system_notification.cc b/chrome/browser/chromeos/notifications/system_notification.cc index 83debd5..f83c414 100644 --- a/chrome/browser/chromeos/notifications/system_notification.cc +++ b/chrome/browser/chromeos/notifications/system_notification.cc @@ -5,7 +5,6 @@ #include "chrome/browser/chromeos/notifications/system_notification.h" #include "base/callback.h" -#include "base/move.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/notifications/system_notification_factory.h" #include "chrome/browser/dom_ui/dom_ui_util.h" @@ -14,15 +13,17 @@ namespace chromeos { -SystemNotification::SystemNotification(Profile* profile, std::string id, - int icon_resource_id, string16 title) - : profile_(profile), - collection_(static_cast<BalloonCollectionImpl*>( - g_browser_process->notification_ui_manager()->balloon_collection())), - delegate_(new Delegate(base::move(id))), - title_(move(title)), - visible_(false), - urgent_(false) { +SystemNotification::SystemNotification(Profile* profile, + const std::string& id, + int icon_resource_id, + const string16& title) + : profile_(profile), + collection_(static_cast<BalloonCollectionImpl*>( + g_browser_process->notification_ui_manager()->balloon_collection())), + delegate_(new Delegate(id)), + title_(title), + visible_(false), + urgent_(false) { std::string url = dom_ui_util::GetImageDataUrlFromResource(icon_resource_id); DCHECK(!url.empty()); GURL tmp_gurl(url); diff --git a/chrome/browser/chromeos/notifications/system_notification.h b/chrome/browser/chromeos/notifications/system_notification.h index 82ca8f3..81976b7 100644 --- a/chrome/browser/chromeos/notifications/system_notification.h +++ b/chrome/browser/chromeos/notifications/system_notification.h @@ -9,7 +9,6 @@ #include <string> #include "base/basictypes.h" -#include "base/move.h" #include "base/ref_counted.h" #include "base/string16.h" #include "chrome/browser/chromeos/notifications/balloon_collection_impl.h" @@ -28,8 +27,9 @@ class SystemNotification { // The profile is the current user profile. The id is any string used // to uniquely identify this notification. The title is the title of // the message to be displayed. On creation, the message is hidden. - SystemNotification(Profile* profile, std::string id, int icon_resource_id, - string16 title); + SystemNotification(Profile* profile, const std::string& id, + int icon_resource_id, + const string16& title); virtual ~SystemNotification(); @@ -58,7 +58,7 @@ class SystemNotification { private: class Delegate : public NotificationDelegate { public: - explicit Delegate(std::string id) : id_(base::move(id)) {} + explicit Delegate(const std::string& id) : id_(id) {} void Display() {} void Error() {} void Close(bool by_user) {} |