Base: More adjustments to BASE_API and project dependencies to
use base.dll from chrome.

BUG=76996
TEST=none
Review URL: http://codereview.chromium.org/6877053

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82564 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: 23bb71fb2a8d32adb4f5d9baf36a6b17c2111fa9
diff --git a/base/base.gyp b/base/base.gyp
index 682eacf..85fc58f 100644
--- a/base/base.gyp
+++ b/base/base.gyp
@@ -55,7 +55,8 @@
     },
     {
       # This is the subset of files from base that should not be used with a
-      # dynamic library.
+      # dynamic library. Note that this library cannot depend on base because
+      # base depends on base_static.
       'target_name': 'base_static',
       'type': '<(library)',
       'sources': [
@@ -221,6 +222,7 @@
         'base_i18n',
         'base_static',
         'test_support_base',
+        'third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
         '../testing/gmock.gyp:gmock',
         '../testing/gtest.gyp:gtest',
       ],
@@ -279,10 +281,14 @@
       'type': '<(library)',
       'dependencies': [
         'base',
+        'base_static',
         'base_i18n',
         '../testing/gmock.gyp:gmock',
         '../testing/gtest.gyp:gtest',
       ],
+      'export_dependent_settings': [
+        'base',
+      ],
       'conditions': [
         ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
           'dependencies': [
diff --git a/base/base.gypi b/base/base.gypi
index 51a9643..5db404c 100644
--- a/base/base.gypi
+++ b/base/base.gypi
@@ -40,7 +40,6 @@
           'bind_internal.h',
           'bind_internal_win.h',
           'bits.h',
-          'bzip2_error_handler.cc',
           'callback.h',
           'callback_internal.cc',
           'callback_internal.h',
diff --git a/base/bzip2_error_handler.cc b/base/bzip2_error_handler.cc
deleted file mode 100644
index e66bcf3..0000000
--- a/base/bzip2_error_handler.cc
+++ /dev/null
@@ -1,14 +0,0 @@
-// 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.
-
-#include <ostream>
-
-#include "base/logging.h"
-
-// We define BZ_NO_STDIO in third_party/bzip2 to remove its internal STDERR
-// error reporting.  This requires us to export our own error handler.
-extern "C"
-void bz_internal_error(int errcode) {
-  LOG(FATAL) << "bzip2 internal error: " << errcode;
-}
diff --git a/base/debug/profiler.h b/base/debug/profiler.h
index e3044d6..55c0c9f 100644
--- a/base/debug/profiler.h
+++ b/base/debug/profiler.h
@@ -8,6 +8,8 @@
 
 #include <string>
 
+#include "base/base_api.h"
+
 // The Profiler functions allow usage of the underlying sampling based
 // profiler. If the application has not been built with the necessary
 // flags (-DENABLE_PROFILING and not -DNO_TCMALLOC) then these functions
@@ -18,16 +20,16 @@
 // Start profiling with the supplied name.
 // {pid} will be replaced by the process' pid and {count} will be replaced
 // by the count of the profile run (starts at 1 with each process).
-void StartProfiling(const std::string& name);
+BASE_API void StartProfiling(const std::string& name);
 
 // Stop profiling and write out data.
-void StopProfiling();
+BASE_API void StopProfiling();
 
 // Force data to be written to file.
-void FlushProfiling();
+BASE_API void FlushProfiling();
 
 // Returns true if process is being profiled.
-bool BeingProfiled();
+BASE_API bool BeingProfiled();
 
 }  // namespace debug
 }  // namespace base
diff --git a/base/files/file_path_watcher.h b/base/files/file_path_watcher.h
index 2cf95c6..ec41f53 100644
--- a/base/files/file_path_watcher.h
+++ b/base/files/file_path_watcher.h
@@ -8,6 +8,7 @@
 #define BASE_FILES_FILE_PATH_WATCHER_H_
 #pragma once
 
+#include "base/base_api.h"
 #include "base/basictypes.h"
 #include "base/file_path.h"
 #include "base/memory/ref_counted.h"
@@ -25,7 +26,7 @@
 // detect the creation and deletion of files in a watched directory, but will
 // not detect modifications to those files. See file_path_watcher_mac.cc for
 // details.
-class FilePathWatcher {
+class BASE_API FilePathWatcher {
  public:
   // Declares the callback client code implements to receive notifications. Note
   // that implementations of this interface should not keep a reference to the
diff --git a/base/logging.h b/base/logging.h
index 0e78e1a..1c2a22f 100644
--- a/base/logging.h
+++ b/base/logging.h
@@ -794,7 +794,7 @@
 // This class is used to explicitly ignore values in the conditional
 // logging macros.  This avoids compiler warnings like "value computed
 // is not used" and "statement has no effect".
-class BASE_API LogMessageVoidify {
+class LogMessageVoidify {
  public:
   LogMessageVoidify() { }
   // This has to be an operator with a precedence lower than << but
diff --git a/base/message_loop.h b/base/message_loop.h
index b601d9e..a64196c 100644
--- a/base/message_loop.h
+++ b/base/message_loop.h
@@ -377,7 +377,7 @@
 #endif
   };
 
-  class AutoRunState : RunState {
+  class BASE_API AutoRunState : RunState {
    public:
     explicit AutoRunState(MessageLoop* loop);
     ~AutoRunState();
diff --git a/base/string_util.h b/base/string_util.h
index 81d31d3..9864137 100644
--- a/base/string_util.h
+++ b/base/string_util.h
@@ -36,29 +36,28 @@
 // Compares the two strings s1 and s2 without regard to case using
 // the current locale; returns 0 if they are equal, 1 if s1 > s2, and -1 if
 // s2 > s1 according to a lexicographic comparison.
-BASE_API int strcasecmp(const char* s1, const char* s2);
+int strcasecmp(const char* s1, const char* s2);
 
 // Compares up to count characters of s1 and s2 without regard to case using
 // the current locale; returns 0 if they are equal, 1 if s1 > s2, and -1 if
 // s2 > s1 according to a lexicographic comparison.
-BASE_API int strncasecmp(const char* s1, const char* s2, size_t count);
+int strncasecmp(const char* s1, const char* s2, size_t count);
 
 // Same as strncmp but for char16 strings.
-BASE_API int strncmp16(const char16* s1, const char16* s2, size_t count);
+int strncmp16(const char16* s1, const char16* s2, size_t count);
 
 // Wrapper for vsnprintf that always null-terminates and always returns the
 // number of characters that would be in an untruncated formatted
 // string, even when truncation occurs.
-BASE_API int vsnprintf(char* buffer, size_t size, const char* format,
-                       va_list arguments)
+int vsnprintf(char* buffer, size_t size, const char* format, va_list arguments)
     PRINTF_FORMAT(3, 0);
 
 // vswprintf always null-terminates, but when truncation occurs, it will either
 // return -1 or the number of characters that would be in an untruncated
 // formatted string.  The actual return value depends on the underlying
 // C library's vswprintf implementation.
-BASE_API int vswprintf(wchar_t* buffer, size_t size,
-                       const wchar_t* format, va_list arguments)
+int vswprintf(wchar_t* buffer, size_t size,
+              const wchar_t* format, va_list arguments)
     WPRINTF_FORMAT(3, 0);
 
 // Some of these implementations need to be inlined.
@@ -172,11 +171,11 @@
 BASE_API const std::wstring& EmptyWString();
 BASE_API const string16& EmptyString16();
 
-extern const wchar_t kWhitespaceWide[];
-extern const char16 kWhitespaceUTF16[];
-extern const char kWhitespaceASCII[];
+BASE_API extern const wchar_t kWhitespaceWide[];
+BASE_API extern const char16 kWhitespaceUTF16[];
+BASE_API extern const char kWhitespaceASCII[];
 
-extern const char kUtf8ByteOrderMark[];
+BASE_API extern const char kUtf8ByteOrderMark[];
 
 // Removes characters in remove_chars from anywhere in input.  Returns true if
 // any characters were removed.
diff --git a/base/tracked_objects.h b/base/tracked_objects.h
index 99b5ed2..561eaee 100644
--- a/base/tracked_objects.h
+++ b/base/tracked_objects.h
@@ -630,7 +630,7 @@
 // only allow the tracking system to be started up at most once, and shutdown
 // at most once.  See bug 31344 for an example.
 
-class AutoTracking {
+class BASE_API AutoTracking {
  public:
   AutoTracking() {
     if (state_ != kNeverBeenRun)
diff --git a/base/utf_offset_string_conversions.h b/base/utf_offset_string_conversions.h
index 152eda3..76247a6 100644
--- a/base/utf_offset_string_conversions.h
+++ b/base/utf_offset_string_conversions.h
@@ -76,10 +76,10 @@
 // AdjustOffset(adjustments). Each Adjustment gives the original |location|
 // of the encoded section and the |old_length| and |new_length| of the section
 // before and after decoding.
-struct AdjustOffset {
+struct BASE_API AdjustOffset {
   // Helper structure which indicates where an encoded character occurred
   // and how long that encoding was.
-  struct Adjustment {
+  struct BASE_API Adjustment {
     Adjustment(size_t location, size_t old_length, size_t new_length);
 
     size_t location;
diff --git a/base/utf_string_conversion_utils.h b/base/utf_string_conversion_utils.h
index a34c9ae..baa7b5c 100644
--- a/base/utf_string_conversion_utils.h
+++ b/base/utf_string_conversion_utils.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.
 
@@ -8,6 +8,7 @@
 
 // This should only be used by the various UTF string conversion files.
 
+#include "base/base_api.h"
 #include "base/string16.h"
 
 namespace base {
@@ -60,7 +61,8 @@
 
 // Appends a UTF-8 character to the given 8-bit string.  Returns the number of
 // bytes written.
-size_t WriteUnicodeCharacter(uint32 code_point, std::string* output);
+// TODO(brettw) Bug 79631: This function should not be exposed.
+BASE_API size_t WriteUnicodeCharacter(uint32 code_point, std::string* output);
 
 // Appends the given code point as a UTF-16 character to the given 16-bit
 // string.  Returns the number of 16-bit values written.