summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-22 21:12:58 +0000
committerajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-22 21:12:58 +0000
commit206a2ae8a1ebd2b040753fff7da61bbca117757f (patch)
tree8ca9b401ccb608dada5e388d0b7905ed2e140fe1 /chrome
parentb06392858ab76a6720352022f224b1144af06548 (diff)
downloadchromium_src-206a2ae8a1ebd2b040753fff7da61bbca117757f.zip
chromium_src-206a2ae8a1ebd2b040753fff7da61bbca117757f.tar.gz
chromium_src-206a2ae8a1ebd2b040753fff7da61bbca117757f.tar.bz2
Redo r113722 - Add Pass(), which implements move semantics, to scoped_ptr, scoped_array....
-- This time for sure. -- Add Pass(), which implements move semantics, to scoped_ptr, scoped_array, and scoped_ptr_malloc. This modification to the scopers implements the "moveable but not copyable" semantics that were introduced in C++11's unique_ptr<>. With this, is now possible to use scopers as an argument type or a return type. This signifies, in the type system, transfer of ownership into a function or out of a function respectively. Calling, or returning such a function MUST use the temporary resulting from a function or explicit cast. This distinction makes it possible to avoid the implicit ownership transfer issues of auto_ptr, but still allow us to have compiler enforced ownership transfer. Also adds a Passed() helper that allows using a scoper with Bind(). Original Review URL: http://codereview.chromium.org/8774032 BUG=96118 TEST=new unittests Review URL: http://codereview.chromium.org/9018037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115607 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chromeos/stub_cros_settings_provider_unittest.cc2
-rw-r--r--chrome/common/extensions/extension_manifests_unittest.cc13
2 files changed, 14 insertions, 1 deletions
diff --git a/chrome/browser/chromeos/stub_cros_settings_provider_unittest.cc b/chrome/browser/chromeos/stub_cros_settings_provider_unittest.cc
index f561bb5..fe1d25b 100644
--- a/chrome/browser/chromeos/stub_cros_settings_provider_unittest.cc
+++ b/chrome/browser/chromeos/stub_cros_settings_provider_unittest.cc
@@ -7,7 +7,7 @@
#include <string>
#include "base/bind.h"
-#include "base/scoped_ptr.h"
+#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "chrome/browser/chromeos/cros_settings_names.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/common/extensions/extension_manifests_unittest.cc b/chrome/common/extensions/extension_manifests_unittest.cc
index 6fd314e..5f63aca 100644
--- a/chrome/common/extensions/extension_manifests_unittest.cc
+++ b/chrome/common/extensions/extension_manifests_unittest.cc
@@ -74,6 +74,19 @@ class ExtensionManifestTest : public testing::Test {
Manifest(DictionaryValue* manifest, const char* name)
: name_(name), manifest_(manifest) {
}
+ Manifest(const Manifest& m) {
+ // C++98 requires the copy constructor for a type to be visiable if you
+ // take a const-ref of a temporary for that type. Since Manifest
+ // contains a scoped_ptr, its implicit copy constructor is declared
+ // Manifest(Manifest&) according to spec 12.8.5. This breaks the first
+ // requirement and thus you cannot use it with LoadAndExpectError() or
+ // LoadAndExpectSuccess() easily.
+ //
+ // To get around this spec pedantry, we declare the copy constructor
+ // explicitly. It will never get invoked.
+ NOTREACHED();
+ }
+
const std::string& name() const { return name_; }