From 22afac4f37b7ff1ad94224b0b26ddac89757916c Mon Sep 17 00:00:00 2001 From: "blundell@chromium.org" Date: Mon, 1 Jul 2013 14:58:10 +0000 Subject: Create top-level ios/public/ directory. To better mirror the structure of other API layers (content/public and third_party/WebKit/public), there will be a single ios/public/ directory that contains all interfaces referenced by not-yet-upstreamed Chrome for iOS code, rather than these interfaces being scattered in subdirectories further underneath ios/. This CL also changes gyp structure to better match other modules: ios_consumer.gyp is moved to directly under ios/, and an ios.gyp is created with a single top-level "ios" target to be used in build/all.gyp. Review URL: https://chromiumcodereview.appspot.com/18272004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@209434 0039d316-1c4b-4281-b951-d872f2087c98 --- ios/consumer/base/supports_user_data.cc | 2 +- ios/consumer/base/supports_user_data_unittest.cc | 2 +- ios/consumer/base/util.mm | 2 +- ios/consumer/ios_consumer.gyp | 41 ------------------- ios/consumer/public/DEPS | 11 ------ ios/consumer/public/base/supports_user_data.h | 50 ------------------------ ios/consumer/public/base/util.h | 18 --------- ios/ios.gyp | 17 ++++++++ ios/ios_consumer.gyp | 41 +++++++++++++++++++ ios/public/DEPS | 11 ++++++ ios/public/consumer/base/supports_user_data.h | 50 ++++++++++++++++++++++++ ios/public/consumer/base/util.h | 18 +++++++++ 12 files changed, 140 insertions(+), 123 deletions(-) delete mode 100644 ios/consumer/ios_consumer.gyp delete mode 100644 ios/consumer/public/DEPS delete mode 100644 ios/consumer/public/base/supports_user_data.h delete mode 100644 ios/consumer/public/base/util.h create mode 100644 ios/ios.gyp create mode 100644 ios/ios_consumer.gyp create mode 100644 ios/public/DEPS create mode 100644 ios/public/consumer/base/supports_user_data.h create mode 100644 ios/public/consumer/base/util.h (limited to 'ios') diff --git a/ios/consumer/base/supports_user_data.cc b/ios/consumer/base/supports_user_data.cc index f317fa2..74ed3a7 100644 --- a/ios/consumer/base/supports_user_data.cc +++ b/ios/consumer/base/supports_user_data.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ios/consumer/public/base/supports_user_data.h" +#include "ios/public/consumer/base/supports_user_data.h" #include "base/memory/scoped_ptr.h" #include "base/supports_user_data.h" diff --git a/ios/consumer/base/supports_user_data_unittest.cc b/ios/consumer/base/supports_user_data_unittest.cc index b38c2db..1aeb417 100644 --- a/ios/consumer/base/supports_user_data_unittest.cc +++ b/ios/consumer/base/supports_user_data_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ios/consumer/public/base/supports_user_data.h" +#include "ios/public/consumer/base/supports_user_data.h" #include "base/memory/scoped_ptr.h" #include "testing/gmock/include/gmock/gmock.h" diff --git a/ios/consumer/base/util.mm b/ios/consumer/base/util.mm index 6a94f8f..1e640f5 100644 --- a/ios/consumer/base/util.mm +++ b/ios/consumer/base/util.mm @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "base/ios/ios_util.h" -#include "ios/consumer/public/base/util.h" +#include "ios/public/consumer/base/util.h" namespace ios { diff --git a/ios/consumer/ios_consumer.gyp b/ios/consumer/ios_consumer.gyp deleted file mode 100644 index 3844e9b..0000000 --- a/ios/consumer/ios_consumer.gyp +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright 2013 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. -{ - 'variables': { - 'chromium_code': 1, - }, - 'targets': [ - { - 'target_name': 'ios_consumer_base', - 'type': 'static_library', - 'dependencies': [ - '../../base/base.gyp:base', - ], - 'include_dirs': [ - '../..', - ], - 'sources': [ - 'base/supports_user_data.cc', - 'base/util.mm', - 'public/base/supports_user_data.h', - 'public/base/util.h', - ], - }, - { - 'target_name': 'ios_consumer_unittests', - 'type': '<(gtest_target_type)', - 'dependencies': [ - '../../base/base.gyp:base', - '../../base/base.gyp:run_all_unittests', - '../../base/base.gyp:test_support_base', - '../../testing/gmock.gyp:gmock', - '../../testing/gtest.gyp:gtest', - 'ios_consumer_base', - ], - 'sources': [ - 'base/supports_user_data_unittest.cc', - ], - }, - ], -} diff --git a/ios/consumer/public/DEPS b/ios/consumer/public/DEPS deleted file mode 100644 index b9ffa71..0000000 --- a/ios/consumer/public/DEPS +++ /dev/null @@ -1,11 +0,0 @@ -include_rules = [ - # The public interfaces cannot reference Chromium code, so all allowances - # that the top-level DEPS file introduces are removed here. This list should - # be kept in sync with src/DEPS. - "-base", - "-build", - "-googleurl", - "-library_loaders", - "-testing", - "-third_party/icu/public", -] diff --git a/ios/consumer/public/base/supports_user_data.h b/ios/consumer/public/base/supports_user_data.h deleted file mode 100644 index 16b5ebe..0000000 --- a/ios/consumer/public/base/supports_user_data.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2013 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 IOS_BASE_SUPPORTS_USER_DATA_H_ -#define IOS_BASE_SUPPORTS_USER_DATA_H_ - -namespace ios { - -class SupportsUserDataInternal; - -// This is a helper for classes that want to allow users to stash random data by -// key. At destruction all the objects will be destructed. -class SupportsUserData { - public: - SupportsUserData(); - - // Derive from this class and add your own data members to associate extra - // information with this object. Alternatively, add this as a public base - // class to any class with a virtual destructor. - class Data { - public: - virtual ~Data() {} - }; - - // The user data allows the clients to associate data with this object. - // Multiple user data values can be stored under different keys. - // This object will TAKE OWNERSHIP of the given data pointer, and will - // delete the object if it is changed or the object is destroyed. - Data* GetUserData(const void* key) const; - void SetUserData(const void* key, Data* data); - void RemoveUserData(const void* key); - - // SupportsUserData is not thread-safe, and on debug build will assert it is - // only used on one thread. Calling this method allows the caller to hand - // the SupportsUserData instance across threads. Use only if you are taking - // full control of the synchronization of that handover. - void DetachUserDataThread(); - - protected: - virtual ~SupportsUserData(); - - private: - // Owned by this object and scoped to its lifetime. - SupportsUserDataInternal* internal_helper_; -}; - -} // namespace ios - -#endif // IOS_BASE_SUPPORTS_USER_DATA_H_ diff --git a/ios/consumer/public/base/util.h b/ios/consumer/public/base/util.h deleted file mode 100644 index 9820834..0000000 --- a/ios/consumer/public/base/util.h +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2013 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 IOS_CONSUME_PUBLIC_BASE_UTIL_H_ -#define IOS_CONSUME_PUBLIC_BASE_UTIL_H_ - -namespace ios { - -// Returns whether the operating system is iOS 6 or later. -bool IsRunningOnIOS6OrLater(); - -// Returns whether the operating system is at the given version or later. -bool IsRunningOnOrLater(int major, int minor, int bug_fix); - -} // namespace ios - -#endif // IOS_CONSUME_PUBLIC_BASE_UTIL_H_ diff --git a/ios/ios.gyp b/ios/ios.gyp new file mode 100644 index 0000000..5e835b3 --- /dev/null +++ b/ios/ios.gyp @@ -0,0 +1,17 @@ +# Copyright 2013 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. +{ + 'variables': { + 'chromium_code': 1, + }, + 'targets': [ + { + 'target_name': 'ios', + 'type': 'none', + 'dependencies': [ + 'ios_consumer.gyp:*', + ], + }, + ], +} diff --git a/ios/ios_consumer.gyp b/ios/ios_consumer.gyp new file mode 100644 index 0000000..f83a0eb --- /dev/null +++ b/ios/ios_consumer.gyp @@ -0,0 +1,41 @@ +# Copyright 2013 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. +{ + 'variables': { + 'chromium_code': 1, + }, + 'targets': [ + { + 'target_name': 'ios_consumer_base', + 'type': 'static_library', + 'dependencies': [ + '../base/base.gyp:base', + ], + 'include_dirs': [ + '..', + ], + 'sources': [ + 'consumer/base/supports_user_data.cc', + 'consumer/base/util.mm', + 'public/consumer/base/supports_user_data.h', + 'public/consumer/base/util.h', + ], + }, + { + 'target_name': 'ios_consumer_unittests', + 'type': '<(gtest_target_type)', + 'dependencies': [ + '../base/base.gyp:base', + '../base/base.gyp:run_all_unittests', + '../base/base.gyp:test_support_base', + '../testing/gmock.gyp:gmock', + '../testing/gtest.gyp:gtest', + 'ios_consumer_base', + ], + 'sources': [ + 'consumer/base/supports_user_data_unittest.cc', + ], + }, + ], +} diff --git a/ios/public/DEPS b/ios/public/DEPS new file mode 100644 index 0000000..b9ffa71 --- /dev/null +++ b/ios/public/DEPS @@ -0,0 +1,11 @@ +include_rules = [ + # The public interfaces cannot reference Chromium code, so all allowances + # that the top-level DEPS file introduces are removed here. This list should + # be kept in sync with src/DEPS. + "-base", + "-build", + "-googleurl", + "-library_loaders", + "-testing", + "-third_party/icu/public", +] diff --git a/ios/public/consumer/base/supports_user_data.h b/ios/public/consumer/base/supports_user_data.h new file mode 100644 index 0000000..5986c57 --- /dev/null +++ b/ios/public/consumer/base/supports_user_data.h @@ -0,0 +1,50 @@ +// Copyright 2013 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 IOS_PUBLIC_CONSUMER_BASE_SUPPORTS_USER_DATA_H_ +#define IOS_PUBLIC_CONSUMER_BASE_SUPPORTS_USER_DATA_H_ + +namespace ios { + +class SupportsUserDataInternal; + +// This is a helper for classes that want to allow users to stash random data by +// key. At destruction all the objects will be destructed. +class SupportsUserData { + public: + SupportsUserData(); + + // Derive from this class and add your own data members to associate extra + // information with this object. Alternatively, add this as a public base + // class to any class with a virtual destructor. + class Data { + public: + virtual ~Data() {} + }; + + // The user data allows the clients to associate data with this object. + // Multiple user data values can be stored under different keys. + // This object will TAKE OWNERSHIP of the given data pointer, and will + // delete the object if it is changed or the object is destroyed. + Data* GetUserData(const void* key) const; + void SetUserData(const void* key, Data* data); + void RemoveUserData(const void* key); + + // SupportsUserData is not thread-safe, and on debug build will assert it is + // only used on one thread. Calling this method allows the caller to hand + // the SupportsUserData instance across threads. Use only if you are taking + // full control of the synchronization of that handover. + void DetachUserDataThread(); + + protected: + virtual ~SupportsUserData(); + + private: + // Owned by this object and scoped to its lifetime. + SupportsUserDataInternal* internal_helper_; +}; + +} // namespace ios + +#endif // IOS_PUBLIC_CONSUMER_BASE_SUPPORTS_USER_DATA_H_ diff --git a/ios/public/consumer/base/util.h b/ios/public/consumer/base/util.h new file mode 100644 index 0000000..5977ea7 --- /dev/null +++ b/ios/public/consumer/base/util.h @@ -0,0 +1,18 @@ +// Copyright 2013 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 IOS_PUBLIC_CONSUMER_BASE_UTIL_H_ +#define IOS_PUBLIC_CONSUMER_BASE_UTIL_H_ + +namespace ios { + +// Returns whether the operating system is iOS 6 or later. +bool IsRunningOnIOS6OrLater(); + +// Returns whether the operating system is at the given version or later. +bool IsRunningOnOrLater(int major, int minor, int bug_fix); + +} // namespace ios + +#endif // IOS_PUBLIC_CONSUMER_BASE_UTIL_H_ -- cgit v1.1