Base: Last set of files to use BASE_API (for base.dll)
Note that a bunck of these files have no unit tests :(
BUG=76996
TEST=none
Review URL: http://codereview.chromium.org/6747014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79633 0039d316-1c4b-4281-b951-d872f2087c98
CrOS-Libchrome-Original-Commit: 9493ee95cd8475d2ce39276fddca3b4b3d3ae73e
diff --git a/base/base.gypi b/base/base.gypi
index 7777cba..502ebbd 100644
--- a/base/base.gypi
+++ b/base/base.gypi
@@ -110,6 +110,7 @@
'logging.cc',
'logging.h',
'logging_win.cc',
+ 'logging_win.h',
'mac/cocoa_protocols.h',
'mac/foundation_util.h',
'mac/foundation_util.mm',
diff --git a/base/base_api.h b/base/base_api.h
index e3cfd28..83b4bdf 100644
--- a/base/base_api.h
+++ b/base/base_api.h
@@ -6,16 +6,12 @@
#define BASE_BASE_API_H_
#pragma once
-#if !defined(BASE_IMPLEMENTATION)
-#define BASE_IMPLEMENTATION 0
-#endif
-
#if defined(WIN32) && defined(BASE_DLL)
-#if BASE_IMPLEMENTATION
+#if defined(BASE_IMPLEMENTATION)
#define BASE_API __declspec(dllexport)
#else
#define BASE_API __declspec(dllimport)
-#endif
+#endif // defined(BASE_IMPLEMENTATION)
#else
#define BASE_API
#endif
diff --git a/base/crypto/capi_util.h b/base/crypto/capi_util.h
index df7f749..f4b7e68 100644
--- a/base/crypto/capi_util.h
+++ b/base/crypto/capi_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -9,6 +9,8 @@
#include <windows.h>
#include <wincrypt.h>
+#include "base/base_api.h"
+
namespace base {
// CryptAcquireContext when passed CRYPT_NEWKEYSET or CRYPT_DELETEKEYSET in
@@ -21,11 +23,11 @@
// "The CryptAcquireContext function is generally thread safe unless
// CRYPT_NEWKEYSET or CRYPT_DELETEKEYSET is specified in the dwFlags
// parameter."
-BOOL CryptAcquireContextLocked(HCRYPTPROV* prov,
- LPCWSTR container,
- LPCWSTR provider,
- DWORD prov_type,
- DWORD flags);
+BASE_API BOOL CryptAcquireContextLocked(HCRYPTPROV* prov,
+ LPCWSTR container,
+ LPCWSTR provider,
+ DWORD prov_type,
+ DWORD flags);
} // namespace base
diff --git a/base/crypto/encryptor.h b/base/crypto/encryptor.h
index 7718240..360a333 100644
--- a/base/crypto/encryptor.h
+++ b/base/crypto/encryptor.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -8,6 +8,7 @@
#include <string>
+#include "base/base_api.h"
#include "build/build_config.h"
#if defined(USE_NSS)
@@ -20,7 +21,7 @@
class SymmetricKey;
-class Encryptor {
+class BASE_API Encryptor {
public:
enum Mode {
CBC
diff --git a/base/crypto/rsa_private_key.h b/base/crypto/rsa_private_key.h
index 5357adc..1f32982 100644
--- a/base/crypto/rsa_private_key.h
+++ b/base/crypto/rsa_private_key.h
@@ -22,6 +22,7 @@
#include <list>
#include <vector>
+#include "base/base_api.h"
#include "base/basictypes.h"
#if defined(OS_WIN)
@@ -35,7 +36,7 @@
// Used internally by RSAPrivateKey for serializing and deserializing
// PKCS #8 PrivateKeyInfo and PublicKeyInfo.
-class PrivateKeyInfoCodec {
+class BASE_API PrivateKeyInfoCodec {
public:
// ASN.1 encoding of the AlgorithmIdentifier from PKCS #8.
@@ -170,7 +171,7 @@
// Encapsulates an RSA private key. Can be used to generate new keys, export
// keys to other formats, or to extract a public key.
// TODO(hclam): This class should be ref-counted so it can be reused easily.
-class RSAPrivateKey {
+class BASE_API RSAPrivateKey {
public:
~RSAPrivateKey();
diff --git a/base/crypto/secure_hash.h b/base/crypto/secure_hash.h
index 3759218..904d163 100644
--- a/base/crypto/secure_hash.h
+++ b/base/crypto/secure_hash.h
@@ -6,13 +6,14 @@
#define BASE_CRYPTO_SECURE_HASH_H_
#pragma once
+#include "base/base_api.h"
#include "base/basictypes.h"
namespace base {
// A wrapper to calculate secure hashes incrementally, allowing to
// be used when the full input is not known in advance.
-class SecureHash {
+class BASE_API SecureHash {
public:
enum Algorithm {
SHA256,
diff --git a/base/crypto/signature_creator.h b/base/crypto/signature_creator.h
index 3e3afd2..93cf83c 100644
--- a/base/crypto/signature_creator.h
+++ b/base/crypto/signature_creator.h
@@ -20,6 +20,7 @@
#include <vector>
+#include "base/base_api.h"
#include "base/basictypes.h"
#include "base/crypto/rsa_private_key.h"
@@ -31,7 +32,7 @@
// Signs data using a bare private key (as opposed to a full certificate).
// Currently can only sign data using SHA-1 with RSA encryption.
-class SignatureCreator {
+class BASE_API SignatureCreator {
public:
~SignatureCreator();
diff --git a/base/crypto/signature_verifier.h b/base/crypto/signature_verifier.h
index e2b61af..1a2c3e7 100644
--- a/base/crypto/signature_verifier.h
+++ b/base/crypto/signature_verifier.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -16,6 +16,7 @@
#include <vector>
+#include "base/base_api.h"
#include "base/basictypes.h"
#if defined(OS_WIN)
@@ -26,7 +27,7 @@
// The SignatureVerifier class verifies a signature using a bare public key
// (as opposed to a certificate).
-class SignatureVerifier {
+class BASE_API SignatureVerifier {
public:
SignatureVerifier();
~SignatureVerifier();
diff --git a/base/crypto/symmetric_key.h b/base/crypto/symmetric_key.h
index ce98fa6..b72c840 100644
--- a/base/crypto/symmetric_key.h
+++ b/base/crypto/symmetric_key.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -8,6 +8,7 @@
#include <string>
+#include "base/base_api.h"
#include "base/basictypes.h"
#if defined(USE_NSS)
@@ -22,7 +23,7 @@
// Wraps a platform-specific symmetric key and allows it to be held in a
// scoped_ptr.
-class SymmetricKey {
+class BASE_API SymmetricKey {
public:
// Defines the algorithm that a key will be used with. See also
// classs Encrptor.
diff --git a/base/event_recorder.h b/base/event_recorder.h
index e4d8907..21e2922 100644
--- a/base/event_recorder.h
+++ b/base/event_recorder.h
@@ -10,6 +10,8 @@
#include <windows.h>
#include <stdio.h>
#endif
+
+#include "base/base_api.h"
#include "base/basictypes.h"
class FilePath;
@@ -29,7 +31,7 @@
// Why? Imagine if the product had a "record a macro" feature.
// You might be recording globally, while recording or playing back
// a macro. I don't think two playbacks make sense.
-class EventRecorder {
+class BASE_API EventRecorder {
public:
// Get the singleton EventRecorder.
// We can only handle one recorder/player at a time.
diff --git a/base/file_util_proxy.h b/base/file_util_proxy.h
index f975dac..08df57b 100644
--- a/base/file_util_proxy.h
+++ b/base/file_util_proxy.h
@@ -7,6 +7,7 @@
#include <vector>
+#include "base/base_api.h"
#include "base/callback.h"
#include "base/file_path.h"
#include "base/file_util.h"
@@ -20,7 +21,7 @@
class Time;
// This class provides asynchronous access to common file routines.
-class FileUtilProxy {
+class BASE_API FileUtilProxy {
public:
// Holds metadata for file or directory entry. Used by ReadDirectoryCallback.
struct Entry {
diff --git a/base/md5.h b/base/md5.h
index 5ab6e32..10e2a35 100644
--- a/base/md5.h
+++ b/base/md5.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -8,6 +8,8 @@
#include <string>
+#include "base/base_api.h"
+
// MD5 stands for Message Digest algorithm 5.
// MD5 is a robust hash function, designed for cyptography, but often used
// for file checksums. The code is complex and slow, but has few
@@ -42,25 +44,25 @@
// Computes the MD5 sum of the given data buffer with the given length.
// The given 'digest' structure will be filled with the result data.
-void MD5Sum(const void* data, size_t length, MD5Digest* digest);
+BASE_API void MD5Sum(const void* data, size_t length, MD5Digest* digest);
// Initializes the given MD5 context structure for subsequent calls to
// MD5Update().
-void MD5Init(MD5Context* context);
+BASE_API void MD5Init(MD5Context* context);
// For the given buffer of data, updates the given MD5 context with the sum of
// the data. You can call this any number of times during the computation,
// except that MD5Init() must have been called first.
-void MD5Update(MD5Context* context, const void* buf, size_t len);
+BASE_API void MD5Update(MD5Context* context, const void* buf, size_t len);
// Finalizes the MD5 operation and fills the buffer with the digest.
-void MD5Final(MD5Digest* digest, MD5Context* pCtx);
+BASE_API void MD5Final(MD5Digest* digest, MD5Context* pCtx);
// Converts a digest into human-readable hexadecimal.
-std::string MD5DigestToBase16(const MD5Digest& digest);
+BASE_API std::string MD5DigestToBase16(const MD5Digest& digest);
// Returns the MD5 (in hexadecimal) of a string.
-std::string MD5String(const std::string& str);
+BASE_API std::string MD5String(const std::string& str);
#endif // BASE_MD5_H_
diff --git a/base/memory/memory_debug.h b/base/memory/memory_debug.h
index 9cc6c61..d094edb 100644
--- a/base/memory/memory_debug.h
+++ b/base/memory/memory_debug.h
@@ -10,11 +10,12 @@
#define BASE_MEMORY_MEMORY_DEBUG_H_
#pragma once
+#include "base/base_api.h"
#include "base/basictypes.h"
namespace base {
-class MemoryDebug {
+class BASE_API MemoryDebug {
public:
// Since MIU messages are a lot of data, and we don't always want this data,
// we have a global switch. If disabled, *MemoryInUse are no-ops.
diff --git a/base/memory/ref_counted_memory.h b/base/memory/ref_counted_memory.h
index db15792..1a0f51e 100644
--- a/base/memory/ref_counted_memory.h
+++ b/base/memory/ref_counted_memory.h
@@ -8,6 +8,7 @@
#include <vector>
+#include "base/base_api.h"
#include "base/memory/ref_counted.h"
// TODO(erg): The contents of this file should be in a namespace. This would
@@ -16,7 +17,8 @@
// A generic interface to memory. This object is reference counted because one
// of its two subclasses own the data they carry, and we need to have
// heterogeneous containers of these two types of memory.
-class RefCountedMemory : public base::RefCountedThreadSafe<RefCountedMemory> {
+class BASE_API RefCountedMemory
+ : public base::RefCountedThreadSafe<RefCountedMemory> {
public:
// Retrieves a pointer to the beginning of the data we point to. If the data
// is empty, this will return NULL.
@@ -33,7 +35,7 @@
// An implementation of RefCountedMemory, where the ref counting does not
// matter.
-class RefCountedStaticMemory : public RefCountedMemory {
+class BASE_API RefCountedStaticMemory : public RefCountedMemory {
public:
RefCountedStaticMemory()
: data_(NULL), length_(0) {}
@@ -53,7 +55,7 @@
// An implementation of RefCountedMemory, where we own our the data in a
// vector.
-class RefCountedBytes : public RefCountedMemory {
+class BASE_API RefCountedBytes : public RefCountedMemory {
public:
RefCountedBytes();
diff --git a/base/resource_util.h b/base/resource_util.h
index 8a37f95..c867abc 100644
--- a/base/resource_util.h
+++ b/base/resource_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -11,6 +11,7 @@
#include <windows.h>
+#include "base/base_api.h"
#include "base/basictypes.h"
namespace base {
@@ -18,8 +19,8 @@
// Function for getting a data resource (BINDATA) from a dll. Some
// resources are optional, especially in unit tests, so this returns false
// but doesn't raise an error if the resource can't be loaded.
-bool GetDataResourceFromModule(HMODULE module, int resource_id,
- void** data, size_t* length);
+bool BASE_API GetDataResourceFromModule(HMODULE module, int resource_id,
+ void** data, size_t* length);
} // namespace base
#endif // BASE_RESOURCE_UTIL_H__
diff --git a/base/sync_socket.h b/base/sync_socket.h
index 1408b47..bcebbdfa 100644
--- a/base/sync_socket.h
+++ b/base/sync_socket.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -16,9 +16,11 @@
#endif
#include <sys/types.h>
+#include "base/base_api.h"
+
namespace base {
-class SyncSocket {
+class BASE_API SyncSocket {
public:
#if defined(OS_WIN)
typedef HANDLE Handle;
diff --git a/base/synchronization/cancellation_flag.h b/base/synchronization/cancellation_flag.h
index 29ecd89..5738929 100644
--- a/base/synchronization/cancellation_flag.h
+++ b/base/synchronization/cancellation_flag.h
@@ -6,6 +6,7 @@
#define BASE_SYNCHRONIZATION_CANCELLATION_FLAG_H_
#pragma once
+#include "base/base_api.h"
#include "base/atomicops.h"
#include "base/threading/platform_thread.h"
@@ -16,7 +17,7 @@
// is thread-safe.
//
// This class IS NOT intended for synchronization between threads.
-class CancellationFlag {
+class BASE_API CancellationFlag {
public:
CancellationFlag() : flag_(false) {
#if !defined(NDEBUG)
diff --git a/base/synchronization/condition_variable.h b/base/synchronization/condition_variable.h
index db75a49..d70d4cd 100644
--- a/base/synchronization/condition_variable.h
+++ b/base/synchronization/condition_variable.h
@@ -74,6 +74,7 @@
#include <pthread.h>
#endif
+#include "base/base_api.h"
#include "base/basictypes.h"
#include "base/synchronization/lock.h"
@@ -81,7 +82,7 @@
class TimeDelta;
-class ConditionVariable {
+class BASE_API ConditionVariable {
public:
// Construct a cv for use with ONLY one user lock.
explicit ConditionVariable(Lock* user_lock);
diff --git a/base/synchronization/waitable_event_watcher.h b/base/synchronization/waitable_event_watcher.h
index 1b93b66..aa16d0b 100644
--- a/base/synchronization/waitable_event_watcher.h
+++ b/base/synchronization/waitable_event_watcher.h
@@ -15,6 +15,8 @@
#include "base/synchronization/waitable_event.h"
#endif
+#include "base/base_api.h"
+
namespace base {
class Flag;
@@ -58,7 +60,7 @@
// it with a Watcher. It will act as if the event was never signaled.
// -----------------------------------------------------------------------------
-class WaitableEventWatcher
+class BASE_API WaitableEventWatcher
#if defined(OS_POSIX)
: public MessageLoop::DestructionObserver
#endif
diff --git a/base/threading/non_thread_safe.h b/base/threading/non_thread_safe.h
index 83a2178..e4a1c07 100644
--- a/base/threading/non_thread_safe.h
+++ b/base/threading/non_thread_safe.h
@@ -45,7 +45,7 @@
// In Release mode, CalledOnValidThread will always return true.
//
#ifndef NDEBUG
-class BASE_API NonThreadSafe : public NonThreadSafeImpl {
+class NonThreadSafe : public NonThreadSafeImpl {
};
#else
class NonThreadSafe : public NonThreadSafeDoNothing {
diff --git a/base/threading/thread_checker_impl.h b/base/threading/thread_checker_impl.h
index 6d41fdc..02ecebf 100644
--- a/base/threading/thread_checker_impl.h
+++ b/base/threading/thread_checker_impl.h
@@ -6,6 +6,7 @@
#define BASE_THREADING_THREAD_CHECKER_IMPL_H_
#pragma once
+#include "base/base_api.h"
#include "base/synchronization/lock.h"
#include "base/threading/platform_thread.h"
@@ -17,7 +18,7 @@
//
// Note: You should almost always use the ThreadChecker class to get the
// right version for your build configuration.
-class ThreadCheckerImpl {
+class BASE_API ThreadCheckerImpl {
public:
ThreadCheckerImpl();
~ThreadCheckerImpl();
diff --git a/base/threading/thread_collision_warner.h b/base/threading/thread_collision_warner.h
index 38294a3..b26568d 100644
--- a/base/threading/thread_collision_warner.h
+++ b/base/threading/thread_collision_warner.h
@@ -131,12 +131,12 @@
// AsserterBase is the interfaces and DCheckAsserter is the default asserter
// used. During the unit tests is used another class that doesn't "DCHECK"
// in case of collision (check thread_collision_warner_unittests.cc)
-struct AsserterBase {
+struct BASE_API AsserterBase {
virtual ~AsserterBase() {}
virtual void warn() = 0;
};
-struct DCheckAsserter : public AsserterBase {
+struct BASE_API DCheckAsserter : public AsserterBase {
virtual ~DCheckAsserter() {}
virtual void warn();
};
diff --git a/base/threading/thread_local.h b/base/threading/thread_local.h
index 069543f..4bacf92 100644
--- a/base/threading/thread_local.h
+++ b/base/threading/thread_local.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -49,6 +49,7 @@
#define BASE_THREADING_THREAD_LOCAL_H_
#pragma once
+#include "base/base_api.h"
#include "base/basictypes.h"
#if defined(OS_POSIX)
@@ -60,7 +61,7 @@
namespace internal {
// Helper functions that abstract the cross-platform APIs. Do not use directly.
-struct ThreadLocalPlatform {
+struct BASE_API ThreadLocalPlatform {
#if defined(OS_WIN)
typedef unsigned long SlotType;
#elif defined(OS_POSIX)
diff --git a/base/threading/watchdog.h b/base/threading/watchdog.h
index 4af45dc..fafda43 100644
--- a/base/threading/watchdog.h
+++ b/base/threading/watchdog.h
@@ -21,6 +21,7 @@
#include <string>
+#include "base/base_api.h"
#include "base/synchronization/condition_variable.h"
#include "base/synchronization/lock.h"
#include "base/threading/platform_thread.h"
@@ -28,7 +29,7 @@
namespace base {
-class Watchdog {
+class BASE_API Watchdog {
public:
// Constructor specifies how long the Watchdog will wait before alarming.
Watchdog(const TimeDelta& duration,
diff --git a/base/threading/worker_pool.h b/base/threading/worker_pool.h
index 9a02acc..12b50b4 100644
--- a/base/threading/worker_pool.h
+++ b/base/threading/worker_pool.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -6,6 +6,7 @@
#define BASE_THREADING_WORKER_POOL_H_
#pragma once
+#include "base/base_api.h"
#include "base/tracked.h"
class Task;
@@ -20,7 +21,7 @@
// inside the pool must be extremely careful about other objects they access
// (MessageLoops, Singletons, etc). During shutdown these object may no longer
// exist.
-class WorkerPool {
+class BASE_API WorkerPool {
public:
// This function posts |task| to run on a worker thread. |task_is_slow|
// should be used for tasks that will take a long time to execute. Returns
diff --git a/base/value_conversions.h b/base/value_conversions.h
index 9678fc1..75246d1 100644
--- a/base/value_conversions.h
+++ b/base/value_conversions.h
@@ -8,6 +8,8 @@
// This file contains methods to convert a |FilePath| to a |Value| and back.
+#include "base/base_api.h"
+
class FilePath;
class StringValue;
class Value;
@@ -15,8 +17,8 @@
namespace base {
// The caller takes ownership of the returned value.
-StringValue* CreateFilePathValue(const FilePath& in_value);
-bool GetValueAsFilePath(const Value& value, FilePath* file_path);
+BASE_API StringValue* CreateFilePathValue(const FilePath& in_value);
+BASE_API bool GetValueAsFilePath(const Value& value, FilePath* file_path);
} // namespace