Skip to content

Commit

Permalink
Revert of Remove base/move.h (patchset chromium#4 id:60001 of https:/…
Browse files Browse the repository at this point in the history
…/codereview.chromium.org/2038273002/ )

Reason for revert:
This breaks the Windows build on the waterfall.
The error log is:
https://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_compile_dbg_ng/builds/202064/steps/compile%20%28with%20patch%29/logs/stdio

FAILED: obj/ash/mus/lib/shelf_layout_impl.obj
ninja -t msvc -e environment.x86 -- E:\b\build\slave\cache\cipd\goma/gomacc.exe "E:\b\depot_tools\win_toolchain\vs_files\95ddda401ec5678f15eeed01d2bee08fcbc5ee97\VC\bin\amd64_x86/cl.exe" /nologo /showIncludes /FC @obj/ash/mus/lib/shelf_layout_impl.obj.rsp /c ../../ash/mus/shelf_layout_impl.cc /Foobj/ash/mus/lib/shelf_layout_impl.obj /Fd"obj/ash/mus/lib_cc.pdb"
e:\b\build\slave\win\build\src\base\template_util.h(65): error C2718: 'ui::LatencyInfo': actual parameter with requested alignment of 8 won't be aligned
e:\b\build\slave\win\build\src\base\template_util.h(86): note: see reference to class template instantiation 'base::internal::IsAssignableImpl<Lvalue,Rvalue,false>' being compiled
        with
        [
            Lvalue=ui::LatencyInfo &,
            Rvalue=ui::LatencyInfo &&
        ]
e:\b\build\slave\win\build\src\base\template_util.h(103): note: see reference to class template instantiation 'base::is_assignable<ui::LatencyInfo &,ui::LatencyInfo &&>' being compiled
e:\b\build\slave\win\build\src\mojo\public\cpp\bindings\lib\template_util.h(58): note: see reference to class template instantiation 'base::is_move_assignable<T>' being compiled
        with
        [
            T=ui::LatencyInfo
        ]
e:\b\build\slave\win\build\src\mojo\public\cpp\bindings\array.h(34): note: see reference to class template instantiation 'mojo::internal::IsMoveOnlyType<MojomType>' being compiled
        with
        [
            MojomType=ui::LatencyInfo
        ]
e:\b\build\slave\win\build\src\out\debug\gen\cc\ipc\compositor_frame_metadata.mojom.h(121): note: see reference to class template instantiation 'mojo::Array<ui::LatencyInfo>' being compiled

Original issue's description:
> Remove base/move.h
>
> It's the same thing as DISALLOW_COPY_AND_ASSIGN now anyway.
>
> BUG=566182
>
> Committed: https://crrev.com/bb5161ab7ad524a9bced788f8099e786946f3a44
> Cr-Commit-Position: refs/heads/master@{#398237}

TBR=thakis@chromium.org,yzshen@chromium.org,jam@chromium.org,dcheng@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=566182

Review-Url: https://codereview.chromium.org/2047633002
Cr-Commit-Position: refs/heads/master@{#398239}
  • Loading branch information
tzik authored and Commit bot committed Jun 7, 2016
1 parent 948e477 commit b2235ba
Show file tree
Hide file tree
Showing 42 changed files with 161 additions and 101 deletions.
16 changes: 16 additions & 0 deletions PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -1851,6 +1851,8 @@ def _CommonChecks(input_api, output_api):
results.extend(_CheckForInvalidOSMacros(input_api, output_api))
results.extend(_CheckForInvalidIfDefinedMacros(input_api, output_api))
results.extend(_CheckFlakyTestUsage(input_api, output_api))
# TODO(danakj): Remove this when base/move.h is removed.
results.extend(_CheckForUsingPass(input_api, output_api))
results.extend(_CheckAddedDepsHaveTargetApprovals(input_api, output_api))
results.extend(
input_api.canned_checks.CheckChangeHasNoTabs(
Expand Down Expand Up @@ -2017,6 +2019,20 @@ def _CheckForInvalidIfDefinedMacros(input_api, output_api):
bad_macros)]


def _CheckForUsingPass(input_api, output_api):
"""Check all affected files for using side effects of Pass."""
errors = []
for f in input_api.AffectedFiles():
if f.LocalPath().endswith(('.h', '.c', '.cc', '.m', '.mm')):
for lnum, line in f.ChangedContents():
# Warn on any use of foo.Pass().
if input_api.re.search(r'[a-zA-Z0-9_]+\.Pass\(\)', line):
errors.append(output_api.PresubmitError(
('%s:%d uses Pass(); please use std::move() instead. ' +
'See crbug.com/557422.') % (f.LocalPath(), lnum)))
return errors


def _CheckForIPCRules(input_api, output_api):
"""Check for same IPC rules described in
http://www.chromium.org/Home/chromium-security/education/security-tips-for-ipc
Expand Down
1 change: 1 addition & 0 deletions base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ component("base") {
"metrics/user_metrics.cc",
"metrics/user_metrics.h",
"metrics/user_metrics_action.h",
"move.h",
"native_library.h",
"native_library_ios.mm",
"native_library_mac.mm",
Expand Down
1 change: 1 addition & 0 deletions base/base.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@
'metrics/user_metrics.cc',
'metrics/user_metrics.h',
'metrics/user_metrics_action.h',
'move.h',
'native_library.h',
'native_library_ios.mm',
'native_library_mac.mm',
Expand Down
6 changes: 3 additions & 3 deletions base/files/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "base/files/file_path.h"
#include "base/files/file_tracing.h"
#include "base/files/scoped_file.h"
#include "base/macros.h"
#include "base/move.h"
#include "base/time/time.h"
#include "build/build_config.h"

Expand Down Expand Up @@ -54,6 +54,8 @@ typedef struct stat64 stat_wrapper_t;
// to the OS is not considered const, even if there is no apparent change to
// member variables.
class BASE_EXPORT File {
MOVE_ONLY_TYPE_FOR_CPP_03(File)

public:
// FLAG_(OPEN|CREATE).* are mutually exclusive. You should specify exactly one
// of the five (possibly combining with other flags) when opening or creating
Expand Down Expand Up @@ -332,8 +334,6 @@ class BASE_EXPORT File {
Error error_details_;
bool created_;
bool async_;

DISALLOW_COPY_AND_ASSIGN(File);
};

} // namespace base
Expand Down
6 changes: 3 additions & 3 deletions base/memory/scoped_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <vector>

#include "base/logging.h"
#include "base/macros.h"
#include "base/move.h"
#include "base/stl_util.h"

// ScopedVector wraps a vector deleting the elements from its
Expand All @@ -21,6 +21,8 @@
// we have support for moveable types inside containers).
template <class T>
class ScopedVector {
MOVE_ONLY_TYPE_FOR_CPP_03(ScopedVector)

public:
typedef typename std::vector<T*>::allocator_type allocator_type;
typedef typename std::vector<T*>::size_type size_type;
Expand Down Expand Up @@ -140,8 +142,6 @@ class ScopedVector {

private:
std::vector<T*> v_;

DISALLOW_COPY_AND_ASSIGN(ScopedVector);
};

#endif // BASE_MEMORY_SCOPED_VECTOR_H_
44 changes: 44 additions & 0 deletions base/move.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// 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 BASE_MOVE_H_
#define BASE_MOVE_H_

// TODO(dcheng): Remove this header.
#include <utility>

#include "base/compiler_specific.h"
#include "base/macros.h"
#include "build/build_config.h"

// TODO(crbug.com/566182): DEPRECATED!
// Use DISALLOW_COPY_AND_ASSIGN instead, or if your type will be used in
// Callbacks, use DISALLOW_COPY_AND_ASSIGN_WITH_MOVE_FOR_BIND instead.
#define MOVE_ONLY_TYPE_FOR_CPP_03(type) \
DISALLOW_COPY_AND_ASSIGN_WITH_MOVE_FOR_BIND(type)

// A macro to disallow the copy constructor and copy assignment functions.
// This should be used in the private: declarations for a class.
//
// Use this macro instead of DISALLOW_COPY_AND_ASSIGN if you want to pass
// ownership of the type through a base::Callback without heap-allocating it
// into a scoped_ptr. The class must define a move constructor and move
// assignment operator to make this work.
//
// This version of the macro adds a cryptic MoveOnlyTypeForCPP03 typedef for the
// base::Callback implementation to use. See IsMoveOnlyType template and its
// usage in base/callback_internal.h for more details.
// TODO(crbug.com/566182): Remove this macro and use DISALLOW_COPY_AND_ASSIGN
// everywhere instead.
#define DISALLOW_COPY_AND_ASSIGN_WITH_MOVE_FOR_BIND(type) \
private: \
type(const type&) = delete; \
void operator=(const type&) = delete; \
\
public: \
typedef void MoveOnlyTypeForCPP03; \
\
private:

#endif // BASE_MOVE_H_
6 changes: 3 additions & 3 deletions base/process/process.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#define BASE_PROCESS_PROCESS_H_

#include "base/base_export.h"
#include "base/macros.h"
#include "base/move.h"
#include "base/process/process_handle.h"
#include "base/time/time.h"
#include "build/build_config.h"
Expand All @@ -31,6 +31,8 @@ namespace base {
// the process dies, and it may be reused by the system, which means that it may
// end up pointing to the wrong process.
class BASE_EXPORT Process {
MOVE_ONLY_TYPE_FOR_CPP_03(Process)

public:
explicit Process(ProcessHandle handle = kNullProcessHandle);

Expand Down Expand Up @@ -134,8 +136,6 @@ class BASE_EXPORT Process {
#else
ProcessHandle process_;
#endif

DISALLOW_COPY_AND_ASSIGN(Process);
};

#if defined(OS_CHROMEOS)
Expand Down
5 changes: 3 additions & 2 deletions base/scoped_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/move.h"

namespace base {

Expand Down Expand Up @@ -53,6 +54,8 @@ namespace base {
// typedef ScopedGeneric<int, FooScopedTraits> ScopedFoo;
template<typename T, typename Traits>
class ScopedGeneric {
DISALLOW_COPY_AND_ASSIGN_WITH_MOVE_FOR_BIND(ScopedGeneric)

private:
// This must be first since it's used inline below.
//
Expand Down Expand Up @@ -157,8 +160,6 @@ class ScopedGeneric {
const ScopedGeneric<T2, Traits2>& p2) const;

Data data_;

DISALLOW_COPY_AND_ASSIGN(ScopedGeneric);
};

template<class T, class Traits>
Expand Down
1 change: 1 addition & 0 deletions base/values.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/move.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"

Expand Down
5 changes: 3 additions & 2 deletions base/win/scoped_handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/macros.h"
#include "base/move.h"

// TODO(rvargas): remove this with the rest of the verifier.
#if defined(COMPILER_MSVC)
Expand All @@ -36,6 +37,8 @@ namespace win {
// this explicitly is necessary because of bug 528394 and VC++ 2015.
template <class Traits, class Verifier>
class GenericScopedHandle {
MOVE_ONLY_TYPE_FOR_CPP_03(GenericScopedHandle)

public:
typedef typename Traits::Handle Handle;

Expand Down Expand Up @@ -109,8 +112,6 @@ class GenericScopedHandle {
FRIEND_TEST_ALL_PREFIXES(ScopedHandleTest, ActiveVerifierWrongOwner);
FRIEND_TEST_ALL_PREFIXES(ScopedHandleTest, ActiveVerifierUntrackedHandle);
Handle handle_;

DISALLOW_COPY_AND_ASSIGN(GenericScopedHandle);
};

#undef BASE_WIN_GET_CALLER
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/printing/pdf_to_emf_converter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ class PdfToEmfUtilityProcessHostClient

private:
class GetPageCallbackData {
MOVE_ONLY_TYPE_FOR_CPP_03(GetPageCallbackData);

public:
GetPageCallbackData(int page_number,
PdfToEmfConverter::GetPageCallback callback)
Expand Down Expand Up @@ -145,8 +147,6 @@ class PdfToEmfUtilityProcessHostClient
int page_number_;
PdfToEmfConverter::GetPageCallback callback_;
ScopedTempFile emf_;

DISALLOW_COPY_AND_ASSIGN(GetPageCallbackData);
};

~PdfToEmfUtilityProcessHostClient() override;
Expand Down
5 changes: 2 additions & 3 deletions chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/move.h"
#include "base/observer_list.h"
#include "chrome/browser/spellchecker/spellcheck_dictionary.h"
#include "net/url_request/url_fetcher_delegate.h"
Expand Down Expand Up @@ -92,6 +93,7 @@ class SpellcheckHunspellDictionary

// Dictionary file information to be passed between the FILE and UI threads.
struct DictionaryFile {
MOVE_ONLY_TYPE_FOR_CPP_03(DictionaryFile)
public:
DictionaryFile();
~DictionaryFile();
Expand All @@ -104,9 +106,6 @@ class SpellcheckHunspellDictionary

// The dictionary file.
base::File file;

private:
DISALLOW_COPY_AND_ASSIGN(DictionaryFile);
};

// net::URLFetcherDelegate implementation. Called when dictionary download
Expand Down
6 changes: 2 additions & 4 deletions chrome/common/media_galleries/picasa_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/move.h"
#include "ipc/ipc_platform_file.h"

namespace picasa {
Expand Down Expand Up @@ -58,6 +58,7 @@ struct AlbumInfo {
};

struct AlbumTableFiles {
MOVE_ONLY_TYPE_FOR_CPP_03(AlbumTableFiles)
public:
AlbumTableFiles();
explicit AlbumTableFiles(const base::FilePath& directory_path);
Expand All @@ -75,9 +76,6 @@ struct AlbumTableFiles {
base::File name_file;
base::File token_file;
base::File uid_file;

private:
DISALLOW_COPY_AND_ASSIGN(AlbumTableFiles);
};

// A mirror of AlbumTableFiles but for transit.
Expand Down
4 changes: 2 additions & 2 deletions components/nacl/browser/nacl_process_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ unsigned NaClProcessHost::keepalive_throttle_interval_milliseconds_ =
// that this only takes a transferred IPC::ChannelHandle or one to be
// transferred via IPC.
class NaClProcessHost::ScopedChannelHandle {
MOVE_ONLY_TYPE_FOR_CPP_03(ScopedChannelHandle);

public:
ScopedChannelHandle() {
}
Expand Down Expand Up @@ -273,8 +275,6 @@ class NaClProcessHost::ScopedChannelHandle {
}

IPC::ChannelHandle handle_;

DISALLOW_COPY_AND_ASSIGN(ScopedChannelHandle);
};

NaClProcessHost::NaClProcessHost(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/move.h"
#include "content/common/content_export.h"
#include "media/audio/audio_input_writer.h"
#include "media/base/audio_parameters.h"
Expand Down
6 changes: 3 additions & 3 deletions content/child/scoped_web_callbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include <utility>

#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/move.h"
#include "third_party/WebKit/public/platform/WebCallbacks.h"

// A ScopedWebCallbacks is a move-only scoper which helps manage the lifetime of
Expand Down Expand Up @@ -67,6 +67,8 @@
// our desired default behavior before deleting the WebCallbacks.
template <typename CallbacksType>
class ScopedWebCallbacks {
MOVE_ONLY_TYPE_FOR_CPP_03(ScopedWebCallbacks);

public:
using DestructionCallback =
base::Callback<void(std::unique_ptr<CallbacksType> callbacks)>;
Expand Down Expand Up @@ -96,8 +98,6 @@ class ScopedWebCallbacks {
private:
std::unique_ptr<CallbacksType> callbacks_;
DestructionCallback destruction_callback_;

DISALLOW_COPY_AND_ASSIGN(ScopedWebCallbacks);
};

template <typename CallbacksType>
Expand Down
6 changes: 3 additions & 3 deletions dbus/file_descriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <memory>

#include "base/macros.h"
#include "base/move.h"
#include "dbus/dbus_export.h"

namespace dbus {
Expand All @@ -34,6 +34,8 @@ namespace dbus {
// also allows the caller to do this work on the File thread to conform
// with i/o restrictions.
class CHROME_DBUS_EXPORT FileDescriptor {
MOVE_ONLY_TYPE_FOR_CPP_03(FileDescriptor);

public:
// This provides a simple way to pass around file descriptors since they must
// be closed on a thread that is allowed to perform I/O.
Expand Down Expand Up @@ -80,8 +82,6 @@ class CHROME_DBUS_EXPORT FileDescriptor {
int value_;
bool owner_;
bool valid_;

DISALLOW_COPY_AND_ASSIGN(FileDescriptor);
};

using ScopedFileDescriptor =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/move.h"
#include "base/single_thread_task_runner.h"
#include "base/threading/thread_checker.h"
#include "extensions/renderer/api/display_source/wifi_display/wifi_display_elementary_stream_info.h"
Expand Down
Loading

0 comments on commit b2235ba

Please sign in to comment.