Skip to content

Commit

Permalink
Base: Last set of files to use BASE_API (for base.dll)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rvargas@google.com committed Mar 28, 2011
1 parent 34ca585 commit 9493ee9
Show file tree
Hide file tree
Showing 37 changed files with 138 additions and 93 deletions.
1 change: 1 addition & 0 deletions base/base.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
8 changes: 2 additions & 6 deletions base/base_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 8 additions & 6 deletions base/crypto/capi_util.h
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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
Expand All @@ -21,11 +23,11 @@ namespace base {
// "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

Expand Down
5 changes: 3 additions & 2 deletions base/crypto/encryptor.h
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -8,6 +8,7 @@

#include <string>

#include "base/base_api.h"
#include "build/build_config.h"

#if defined(USE_NSS)
Expand All @@ -20,7 +21,7 @@ namespace base {

class SymmetricKey;

class Encryptor {
class BASE_API Encryptor {
public:
enum Mode {
CBC
Expand Down
5 changes: 3 additions & 2 deletions base/crypto/rsa_private_key.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ struct SECKEYPublicKeyStr;
#include <list>
#include <vector>

#include "base/base_api.h"
#include "base/basictypes.h"

#if defined(OS_WIN)
Expand All @@ -35,7 +36,7 @@ namespace base {

// 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.
Expand Down Expand Up @@ -170,7 +171,7 @@ class PrivateKeyInfoCodec {
// 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();

Expand Down
3 changes: 2 additions & 1 deletion base/crypto/secure_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion base/crypto/signature_creator.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ struct SGNContextStr;

#include <vector>

#include "base/base_api.h"
#include "base/basictypes.h"
#include "base/crypto/rsa_private_key.h"

Expand All @@ -31,7 +32,7 @@ namespace base {

// 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();

Expand Down
5 changes: 3 additions & 2 deletions base/crypto/signature_verifier.h
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -16,6 +16,7 @@

#include <vector>

#include "base/base_api.h"
#include "base/basictypes.h"

#if defined(OS_WIN)
Expand All @@ -26,7 +27,7 @@ namespace base {

// 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();
Expand Down
5 changes: 3 additions & 2 deletions base/crypto/symmetric_key.h
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -8,6 +8,7 @@

#include <string>

#include "base/base_api.h"
#include "base/basictypes.h"

#if defined(USE_NSS)
Expand All @@ -22,7 +23,7 @@ namespace base {

// 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.
Expand Down
12 changes: 7 additions & 5 deletions base/debug/trace_event_win.h
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -8,6 +8,8 @@
#pragma once

#include <string>

#include "base/base_api.h"
#include "base/win/event_trace_provider.h"

#define TRACE_EVENT_BEGIN(name, id, extra) \
Expand Down Expand Up @@ -40,7 +42,7 @@ namespace debug {

// This EtwTraceProvider subclass implements ETW logging
// for the macros above on Windows.
class TraceLog : public base::win::EtwTraceProvider {
class BASE_API TraceLog : public base::win::EtwTraceProvider {
public:
enum EventType {
EVENT_BEGIN,
Expand Down Expand Up @@ -117,13 +119,13 @@ class TraceLog : public base::win::EtwTraceProvider {
};

// The ETW trace provider GUID.
extern const GUID kChromeTraceProviderName;
BASE_API extern const GUID kChromeTraceProviderName;

// The ETW event class GUID for 32 bit events.
extern const GUID kTraceEventClass32;
BASE_API extern const GUID kTraceEventClass32;

// The ETW event class GUID for 64 bit events.
extern const GUID kTraceEventClass64;
BASE_API extern const GUID kTraceEventClass64;

// The ETW event types, IDs 0x00-0x09 are reserved, so start at 0x10.
const base::win::EtwEventType kTraceEventTypeBegin = 0x10;
Expand Down
4 changes: 3 additions & 1 deletion base/event_recorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <windows.h>
#include <stdio.h>
#endif

#include "base/base_api.h"
#include "base/basictypes.h"

class FilePath;
Expand All @@ -29,7 +31,7 @@ namespace base {
// 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.
Expand Down
3 changes: 2 additions & 1 deletion base/file_util_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -20,7 +21,7 @@ class MessageLoopProxy;
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 {
Expand Down
6 changes: 4 additions & 2 deletions base/logging_win.h
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -7,6 +7,8 @@
#pragma once

#include <string>

#include "base/base_api.h"
#include "base/basictypes.h"
#include "base/win/event_trace_provider.h"
#include "base/logging.h"
Expand Down Expand Up @@ -48,7 +50,7 @@ enum LogMessageTypes {

// Trace provider class to drive log control and transport
// with Event Tracing for Windows.
class LogEventProvider : public base::win::EtwTraceProvider {
class BASE_API LogEventProvider : public base::win::EtwTraceProvider {
public:
static LogEventProvider* GetInstance();

Expand Down
16 changes: 9 additions & 7 deletions base/md5.h
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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
Expand Down Expand Up @@ -42,25 +44,25 @@ typedef char MD5Context[88];

// 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_

3 changes: 2 additions & 1 deletion base/memory/memory_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 5 additions & 3 deletions base/memory/ref_counted_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -33,7 +35,7 @@ class RefCountedMemory : public base::RefCountedThreadSafe<RefCountedMemory> {

// 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) {}
Expand All @@ -53,7 +55,7 @@ class RefCountedStaticMemory : public RefCountedMemory {

// 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();

Expand Down
Loading

0 comments on commit 9493ee9

Please sign in to comment.