diff options
| author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-25 18:48:03 +0000 | 
|---|---|---|
| committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-25 18:48:03 +0000 | 
| commit | 26fbf80ccd8269a6227a7124e9563283da85551a (patch) | |
| tree | 69fef8a1cea0ac6d5e78322e18033091860d46a6 | |
| parent | 90509cbdde392aa218771f6673b9b5a6600c2b57 (diff) | |
| download | chromium_src-26fbf80ccd8269a6227a7124e9563283da85551a.zip chromium_src-26fbf80ccd8269a6227a7124e9563283da85551a.tar.gz chromium_src-26fbf80ccd8269a6227a7124e9563283da85551a.tar.bz2 | |
Base: A few more files using BASE_API (for base.dll)
BUG=76996
TEST=none
Review URL: http://codereview.chromium.org/6736019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79427 0039d316-1c4b-4281-b951-d872f2087c98
| -rw-r--r-- | base/debug/debug_on_start_win.h | 7 | ||||
| -rw-r--r-- | base/debug/debugger.h | 16 | ||||
| -rw-r--r-- | base/debug/stack_trace.h | 5 | ||||
| -rw-r--r-- | base/message_loop.h | 12 | ||||
| -rw-r--r-- | base/message_loop_proxy.h | 6 | ||||
| -rw-r--r-- | base/message_loop_proxy_impl.h | 7 | ||||
| -rw-r--r-- | base/message_pump.h | 7 | ||||
| -rw-r--r-- | base/message_pump_win.h | 7 | ||||
| -rw-r--r-- | base/metrics/histogram.h | 13 | ||||
| -rw-r--r-- | base/metrics/stats_counters.h | 9 | ||||
| -rw-r--r-- | base/metrics/stats_table.h | 3 | ||||
| -rw-r--r-- | base/native_library.h | 16 | ||||
| -rw-r--r-- | base/process.h | 5 | ||||
| -rw-r--r-- | base/process_util.h | 111 | ||||
| -rw-r--r-- | base/scoped_native_library.h | 5 | ||||
| -rw-r--r-- | base/sys_info.h | 5 | ||||
| -rw-r--r-- | base/threading/thread.h | 3 | ||||
| -rw-r--r-- | base/timer.h | 5 | ||||
| -rw-r--r-- | base/tracked_objects.h | 17 | ||||
| -rw-r--r-- | base/vlog.h | 9 | ||||
| -rw-r--r-- | base/weak_ptr.h | 9 | 
21 files changed, 156 insertions, 121 deletions
| diff --git a/base/debug/debug_on_start_win.h b/base/debug/debug_on_start_win.h index 5a1081d..4a5c120 100644 --- a/base/debug/debug_on_start_win.h +++ b/base/debug/debug_on_start_win.h @@ -24,6 +24,11 @@  namespace base {  namespace debug { +// There is no way for this code, as currently implemented, to work across DLLs. +// TODO(rvargas): It looks like we really don't use this code, at least not for +// Chrome. Figure out if it's really worth implementing something simpler. +#if !defined(BASE_DLL) +  // Debug on start functions and data.  class DebugOnStart {   public: @@ -69,6 +74,8 @@ DECLSPEC_SELECTANY DebugOnStart::PIFV debug_on_start = &DebugOnStart::Init;  #endif  // _WIN64 +#endif  // defined(BASE_DLL) +  }  // namespace debug  }  // namespace base diff --git a/base/debug/debugger.h b/base/debug/debugger.h index 77bde0d..bb937a0 100644 --- a/base/debug/debugger.h +++ b/base/debug/debugger.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. @@ -10,16 +10,18 @@  #define BASE_DEBUG_DEBUGGER_H  #pragma once +#include "base/base_api.h" +  namespace base {  namespace debug {  // Starts the registered system-wide JIT debugger to attach it to specified  // process. -bool SpawnDebuggerOnProcess(unsigned process_id); +BASE_API bool SpawnDebuggerOnProcess(unsigned process_id);  // Waits wait_seconds seconds for a debugger to attach to the current process.  // When silent is false, an exception is thrown when a debugger is detected. -bool WaitForDebugger(int wait_seconds, bool silent); +BASE_API bool WaitForDebugger(int wait_seconds, bool silent);  // Returns true if the given process is being run under a debugger.  // @@ -28,18 +30,18 @@ bool WaitForDebugger(int wait_seconds, bool silent);  //  // WARNING: Because of this, on OS X, a call MUST be made to this function  // BEFORE the sandbox is enabled. -bool BeingDebugged(); +BASE_API bool BeingDebugged();  // Break into the debugger, assumes a debugger is present. -void BreakDebugger(); +BASE_API void BreakDebugger();  // Used in test code, this controls whether showing dialogs and breaking into  // the debugger is suppressed for debug errors, even in debug mode (normally  // release mode doesn't do this stuff --  this is controlled separately).  // Normally UI is not suppressed.  This is normally used when running automated  // tests where we want a crash rather than a dialog or a debugger. -void SetSuppressDebugUI(bool suppress); -bool IsDebugUISuppressed(); +BASE_API void SetSuppressDebugUI(bool suppress); +BASE_API bool IsDebugUISuppressed();  }  // namespace debug  }  // namespace base diff --git a/base/debug/stack_trace.h b/base/debug/stack_trace.h index 8afc32c..d8d792d 100644 --- a/base/debug/stack_trace.h +++ b/base/debug/stack_trace.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 <iosfwd> +#include "base/base_api.h"  #include "build/build_config.h"  #if defined(OS_WIN) @@ -20,7 +21,7 @@ namespace debug {  // A stacktrace can be helpful in debugging. For example, you can include a  // stacktrace member in a object (probably around #ifndef NDEBUG) so that you  // can later see where the given object was created from. -class StackTrace { +class BASE_API StackTrace {   public:    // Creates a stacktrace from the current location.    StackTrace(); diff --git a/base/message_loop.h b/base/message_loop.h index e3653f9..fea7e39 100644 --- a/base/message_loop.h +++ b/base/message_loop.h @@ -9,6 +9,7 @@  #include <queue>  #include <string> +#include "base/base_api.h"  #include "base/basictypes.h"  #include "base/message_pump.h"  #include "base/observer_list.h" @@ -65,7 +66,7 @@ class Histogram;  // Please be SURE your task is reentrant (nestable) and all global variables  // are stable and accessible before calling SetNestableTasksAllowed(true).  // -class MessageLoop : public base::MessagePump::Delegate { +class BASE_API MessageLoop : public base::MessagePump::Delegate {   public:  #if defined(OS_WIN)    typedef base::MessagePumpWin::Dispatcher Dispatcher; @@ -117,7 +118,7 @@ class MessageLoop : public base::MessagePump::Delegate {    // NOTE: Any tasks posted to the MessageLoop during this notification will    // not be run.  Instead, they will be deleted.    // -  class DestructionObserver { +  class BASE_API DestructionObserver {     public:      virtual void WillDestroyCurrentMessageLoop() = 0; @@ -283,7 +284,7 @@ class MessageLoop : public base::MessagePump::Delegate {    // MessageLoop.    //    // NOTE: A TaskObserver implementation should be extremely fast! -  class TaskObserver { +  class BASE_API TaskObserver {     public:      TaskObserver(); @@ -496,6 +497,7 @@ class MessageLoop : public base::MessagePump::Delegate {    ObserverList<TaskObserver> task_observers_; + private:    DISALLOW_COPY_AND_ASSIGN(MessageLoop);  }; @@ -506,7 +508,7 @@ class MessageLoop : public base::MessagePump::Delegate {  // This class is typically used like so:  //   MessageLoopForUI::current()->...call some method...  // -class MessageLoopForUI : public MessageLoop { +class BASE_API MessageLoopForUI : public MessageLoop {   public:    MessageLoopForUI() : MessageLoop(TYPE_UI) {    } @@ -562,7 +564,7 @@ COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForUI),  // This class is typically used like so:  //   MessageLoopForIO::current()->...call some method...  // -class MessageLoopForIO : public MessageLoop { +class BASE_API MessageLoopForIO : public MessageLoop {   public:  #if defined(OS_WIN)    typedef base::MessagePumpForIO::IOHandler IOHandler; diff --git a/base/message_loop_proxy.h b/base/message_loop_proxy.h index 6a8cbe8..9ab0b8a 100644 --- a/base/message_loop_proxy.h +++ b/base/message_loop_proxy.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_MESSAGE_LOOP_PROXY_H_  #pragma once +#include "base/base_api.h"  #include "base/basictypes.h"  #include "base/ref_counted.h"  #include "base/task.h" @@ -18,7 +19,7 @@ struct MessageLoopProxyTraits;  // of a message loop. This class can outlive the target message loop. You can  // obtain a MessageLoopProxy via Thread::message_loop_proxy() or  // MessageLoopProxy::CreateForCurrentThread(). -class MessageLoopProxy +class BASE_API MessageLoopProxy      : public base::RefCountedThreadSafe<MessageLoopProxy,                                          MessageLoopProxyTraits> {   public: @@ -58,6 +59,7 @@ class MessageLoopProxy    static scoped_refptr<MessageLoopProxy> CreateForCurrentThread();   protected: +  friend class RefCountedThreadSafe<MessageLoopProxy, MessageLoopProxyTraits>;    friend struct MessageLoopProxyTraits;    MessageLoopProxy(); diff --git a/base/message_loop_proxy_impl.h b/base/message_loop_proxy_impl.h index 03e0271..80d9a26 100644 --- a/base/message_loop_proxy_impl.h +++ b/base/message_loop_proxy_impl.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_MESSAGE_LOOP_PROXY_IMPL_H_  #pragma once +#include "base/base_api.h"  #include "base/message_loop.h"  #include "base/message_loop_proxy.h"  #include "base/synchronization/lock.h" @@ -15,8 +16,8 @@ namespace base {  // A stock implementation of MessageLoopProxy that takes in a MessageLoop  // and keeps track of its lifetime using the MessageLoop DestructionObserver.  // For now a MessageLoopProxyImpl can only be created for the current thread. -class MessageLoopProxyImpl : public MessageLoopProxy, -                             public MessageLoop::DestructionObserver { +class BASE_API MessageLoopProxyImpl : public MessageLoopProxy, +                                      public MessageLoop::DestructionObserver {   public:    virtual ~MessageLoopProxyImpl(); diff --git a/base/message_pump.h b/base/message_pump.h index 866b33a..a356cf3 100644 --- a/base/message_pump.h +++ b/base/message_pump.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 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,17 +6,18 @@  #define BASE_MESSAGE_PUMP_H_  #pragma once +#include "base/base_api.h"  #include "base/ref_counted.h"  namespace base {  class TimeTicks; -class MessagePump : public RefCountedThreadSafe<MessagePump> { +class BASE_API MessagePump : public RefCountedThreadSafe<MessagePump> {   public:    // Please see the comments above the Run method for an illustration of how    // these delegate methods are used. -  class Delegate { +  class BASE_API Delegate {     public:      virtual ~Delegate() {} diff --git a/base/message_pump_win.h b/base/message_pump_win.h index af97530..5642220 100644 --- a/base/message_pump_win.h +++ b/base/message_pump_win.h @@ -10,6 +10,7 @@  #include <list> +#include "base/base_api.h"  #include "base/basictypes.h"  #include "base/message_pump.h"  #include "base/observer_list.h" @@ -21,7 +22,7 @@ namespace base {  // MessagePumpWin serves as the base for specialized versions of the MessagePump  // for Windows. It provides basic functionality like handling of observers and  // controlling the lifetime of the message pump. -class MessagePumpWin : public MessagePump { +class BASE_API MessagePumpWin : public MessagePump {   public:    // An Observer is an object that receives global notifications from the    // UI MessageLoop. @@ -156,7 +157,7 @@ class MessagePumpWin : public MessagePump {  // an excellent choice.  It is also helpful that the starter messages that are  // placed in the queue when new task arrive also awakens DoRunLoop.  // -class MessagePumpForUI : public MessagePumpWin { +class BASE_API MessagePumpForUI : public MessagePumpWin {   public:    // The application-defined code passed to the hook procedure.    static const int kMessageFilterCode = 0x5001; @@ -195,7 +196,7 @@ class MessagePumpForUI : public MessagePumpWin {  // deal with Windows mesagges, and instead has a Run loop based on Completion  // Ports so it is better suited for IO operations.  // -class MessagePumpForIO : public MessagePumpWin { +class BASE_API MessagePumpForIO : public MessagePumpWin {   public:    struct IOContext; diff --git a/base/metrics/histogram.h b/base/metrics/histogram.h index bbc7d56..aab39be 100644 --- a/base/metrics/histogram.h +++ b/base/metrics/histogram.h @@ -36,6 +36,7 @@  #include <string>  #include <vector> +#include "base/base_api.h"  #include "base/gtest_prod_util.h"  #include "base/ref_counted.h"  #include "base/logging.h" @@ -236,7 +237,7 @@ class CustomHistogram;  class Histogram;  class LinearHistogram; -class Histogram : public base::RefCountedThreadSafe<Histogram> { +class BASE_API Histogram : public base::RefCountedThreadSafe<Histogram> {   public:    typedef int Sample;  // Used for samples (and ranges of samples).    typedef int Count;  // Used to count samples in a bucket. @@ -295,7 +296,7 @@ class Histogram : public base::RefCountedThreadSafe<Histogram> {    //----------------------------------------------------------------------------    // Statistic values, developed over the life of the histogram. -  class SampleSet { +  class BASE_API SampleSet {     public:      explicit SampleSet();      ~SampleSet(); @@ -548,7 +549,7 @@ class Histogram : public base::RefCountedThreadSafe<Histogram> {  // LinearHistogram is a more traditional histogram, with evenly spaced  // buckets. -class LinearHistogram : public Histogram { +class BASE_API LinearHistogram : public Histogram {   public:    virtual ~LinearHistogram(); @@ -599,7 +600,7 @@ class LinearHistogram : public Histogram {  //------------------------------------------------------------------------------  // BooleanHistogram is a histogram for booleans. -class BooleanHistogram : public LinearHistogram { +class BASE_API BooleanHistogram : public LinearHistogram {   public:    static scoped_refptr<Histogram> FactoryGet(const std::string& name,        Flags flags); @@ -617,7 +618,7 @@ class BooleanHistogram : public LinearHistogram {  //------------------------------------------------------------------------------  // CustomHistogram is a histogram for a set of custom integers. -class CustomHistogram : public Histogram { +class BASE_API CustomHistogram : public Histogram {   public:    static scoped_refptr<Histogram> FactoryGet(const std::string& name, @@ -642,7 +643,7 @@ class CustomHistogram : public Histogram {  // general place for histograms to register, and supports a global API for  // accessing (i.e., dumping, or graphing) the data in all the histograms. -class StatisticsRecorder { +class BASE_API StatisticsRecorder {   public:    typedef std::vector<scoped_refptr<Histogram> > Histograms; diff --git a/base/metrics/stats_counters.h b/base/metrics/stats_counters.h index 4a93a41..f40dcbe 100644 --- a/base/metrics/stats_counters.h +++ b/base/metrics/stats_counters.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/metrics/stats_table.h"  #include "base/time.h" @@ -74,7 +75,7 @@ namespace base {  //------------------------------------------------------------------------------  // StatsCounter represents a counter in the StatsTable class. -class StatsCounter { +class BASE_API StatsCounter {   public:    // Create a StatsCounter object.    explicit StatsCounter(const std::string& name); @@ -128,7 +129,7 @@ class StatsCounter {  // A StatsCounterTimer is a StatsCounter which keeps a timer during  // the scope of the StatsCounterTimer.  On destruction, it will record  // its time measurement. -class StatsCounterTimer : protected StatsCounter { +class BASE_API StatsCounterTimer : protected StatsCounter {   public:    // Constructs and starts the timer.    explicit StatsCounterTimer(const std::string& name); @@ -157,7 +158,7 @@ class StatsCounterTimer : protected StatsCounter {  // A StatsRate is a timer that keeps a count of the number of intervals added so  // that several statistics can be produced:  //    min, max, avg, count, total -class StatsRate : public StatsCounterTimer { +class BASE_API StatsRate : public StatsCounterTimer {   public:    // Constructs and starts the timer.    explicit StatsRate(const std::string& name); diff --git a/base/metrics/stats_table.h b/base/metrics/stats_table.h index 94f7463..c8ebae7 100644 --- a/base/metrics/stats_table.h +++ b/base/metrics/stats_table.h @@ -23,6 +23,7 @@  #include <string> +#include "base/base_api.h"  #include "base/basictypes.h"  #include "base/hash_tables.h"  #include "base/synchronization/lock.h" @@ -30,7 +31,7 @@  namespace base { -class StatsTable { +class BASE_API StatsTable {   public:    // Create a new StatsTable.    // If a StatsTable already exists with the specified name, this StatsTable diff --git a/base/native_library.h b/base/native_library.h index 6afd06d..9809c98 100644 --- a/base/native_library.h +++ b/base/native_library.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. @@ -9,6 +9,7 @@  // This file defines a cross-platform "NativeLibrary" type which represents  // a loadable module. +#include "base/base_api.h"  #include "build/build_config.h"  #if defined(OS_WIN) @@ -52,7 +53,7 @@ typedef void* NativeLibrary;  // Loads a native library from disk.  Release it with UnloadNativeLibrary when  // you're done. -NativeLibrary LoadNativeLibrary(const FilePath& library_path); +BASE_API NativeLibrary LoadNativeLibrary(const FilePath& library_path);  #if defined(OS_WIN)  // Loads a native library from disk.  Release it with UnloadNativeLibrary when @@ -60,21 +61,22 @@ NativeLibrary LoadNativeLibrary(const FilePath& library_path);  // This function retrieves the LoadLibrary function exported from kernel32.dll  // and calls it instead of directly calling the LoadLibrary function via the  // import table. -NativeLibrary LoadNativeLibraryDynamically(const FilePath& library_path); +BASE_API NativeLibrary LoadNativeLibraryDynamically( +    const FilePath& library_path);  #endif  // OS_WIN  // Unloads a native library. -void UnloadNativeLibrary(NativeLibrary library); +BASE_API void UnloadNativeLibrary(NativeLibrary library);  // Gets a function pointer from a native library. -void* GetFunctionPointerFromNativeLibrary(NativeLibrary library, -                                          const char* name); +BASE_API void* GetFunctionPointerFromNativeLibrary(NativeLibrary library, +                                                   const char* name);  // Returns the full platform specific name for a native library.  // For example:  // "mylib" returns "mylib.dll" on Windows, "libmylib.so" on Linux,  // "mylib.dylib" on Mac. -string16 GetNativeLibraryName(const string16& name); +BASE_API string16 GetNativeLibraryName(const string16& name);  }  // namespace base diff --git a/base/process.h b/base/process.h index 32f5131..a8837141 100644 --- a/base/process.h +++ b/base/process.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 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_PROCESS_H_  #pragma once +#include "base/base_api.h"  #include "base/basictypes.h"  #include "build/build_config.h" @@ -37,7 +38,7 @@ const ProcessHandle kNullProcessHandle = 0;  const int kUnsetProcessPriority = 256;  #endif -class Process { +class BASE_API Process {   public:    Process() : process_(kNullProcessHandle) {  #if defined(OS_POSIX) && !defined(OS_MACOSX) diff --git a/base/process_util.h b/base/process_util.h index 725e04e..dac0635 100644 --- a/base/process_util.h +++ b/base/process_util.h @@ -131,14 +131,14 @@ enum TerminationStatus {  };  // Returns the id of the current process. -ProcessId GetCurrentProcId(); +BASE_API ProcessId GetCurrentProcId();  // Returns the ProcessHandle of the current process. -ProcessHandle GetCurrentProcessHandle(); +BASE_API ProcessHandle GetCurrentProcessHandle();  // Converts a PID to a process handle. This handle must be closed by  // CloseProcessHandle when you are done with it. Returns true on success. -bool OpenProcessHandle(ProcessId pid, ProcessHandle* handle); +BASE_API bool OpenProcessHandle(ProcessId pid, ProcessHandle* handle);  // Converts a PID to a process handle. On Windows the handle is opened  // with more access rights and must only be used by trusted code. @@ -146,21 +146,21 @@ bool OpenProcessHandle(ProcessId pid, ProcessHandle* handle);  // on success.  // TODO(sanjeevr): Replace all calls to OpenPrivilegedProcessHandle with the  // more specific OpenProcessHandleWithAccess method and delete this. -bool OpenPrivilegedProcessHandle(ProcessId pid, ProcessHandle* handle); +BASE_API bool OpenPrivilegedProcessHandle(ProcessId pid, ProcessHandle* handle);  // Converts a PID to a process handle using the desired access flags. Use a  // combination of the kProcessAccess* flags defined above for |access_flags|. -bool OpenProcessHandleWithAccess(ProcessId pid, -                                 uint32 access_flags, -                                 ProcessHandle* handle); +BASE_API bool OpenProcessHandleWithAccess(ProcessId pid, +                                          uint32 access_flags, +                                          ProcessHandle* handle);  // Closes the process handle opened by OpenProcessHandle. -void CloseProcessHandle(ProcessHandle process); +BASE_API void CloseProcessHandle(ProcessHandle process);  // Returns the unique ID for the specified process. This is functionally the  // same as Windows' GetProcessId(), but works on versions of Windows before  // Win XP SP1 as well. -ProcessId GetProcId(ProcessHandle process); +BASE_API ProcessId GetProcId(ProcessHandle process);  #if defined(OS_LINUX)  // Returns the path to the executable of the given process. @@ -200,7 +200,8 @@ enum IntegrityLevel {  // Determine the integrity level of the specified process. Returns false  // if the system does not support integrity levels (pre-Vista) or in the case  // of an underlying system failure. -bool GetProcessIntegrityLevel(ProcessHandle process, IntegrityLevel *level); +BASE_API bool GetProcessIntegrityLevel(ProcessHandle process, +                                       IntegrityLevel *level);  // Runs the given application name with the given command line. Normally, the  // first command line argument should be the path to the process, and don't @@ -216,15 +217,15 @@ bool GetProcessIntegrityLevel(ProcessHandle process, IntegrityLevel *level);  // stored there on a successful launch.  // NOTE: In this case, the caller is responsible for closing the handle so  //       that it doesn't leak! -bool LaunchApp(const std::wstring& cmdline, -               bool wait, bool start_hidden, ProcessHandle* process_handle); +BASE_API bool LaunchApp(const std::wstring& cmdline, +                        bool wait, bool start_hidden, +                        ProcessHandle* process_handle);  // Same as LaunchApp, except allows the new process to inherit handles of the  // parent process. -bool LaunchAppWithHandleInheritance(const std::wstring& cmdline, -                                    bool wait, -                                    bool start_hidden, -                                    ProcessHandle* process_handle); +BASE_API bool LaunchAppWithHandleInheritance(const std::wstring& cmdline, +                                             bool wait, bool start_hidden, +                                             ProcessHandle* process_handle);  // Runs the given application name with the given command line as if the user  // represented by |token| had launched it. The caveats about |cmdline| and @@ -236,15 +237,18 @@ bool LaunchAppWithHandleInheritance(const std::wstring& cmdline,  // To avoid hard to diagnose problems, this function internally loads the  // environment variables associated with the user and if this operation fails  // the entire call fails as well. -bool LaunchAppAsUser(UserTokenHandle token, const std::wstring& cmdline, -                     bool start_hidden, ProcessHandle* process_handle); +BASE_API bool LaunchAppAsUser(UserTokenHandle token, +                              const std::wstring& cmdline, +                              bool start_hidden, +                              ProcessHandle* process_handle);  // Has the same behavior as LaunchAppAsUser, but offers the boolean option to  // use an empty string for the desktop name and a boolean for allowing the  // child process to inherit handles from its parent. -bool LaunchAppAsUser(UserTokenHandle token, const std::wstring& cmdline, -                     bool start_hidden, ProcessHandle* process_handle, -                     bool empty_desktop_name, bool inherit_handles); +BASE_API bool LaunchAppAsUser(UserTokenHandle token, +                              const std::wstring& cmdline, +                              bool start_hidden, ProcessHandle* process_handle, +                              bool empty_desktop_name, bool inherit_handles);  #elif defined(OS_POSIX) @@ -292,14 +296,14 @@ char** AlterEnvironment(const environment_vector& changes,  // Executes the application specified by cl. This function delegates to one  // of the above two platform-specific functions. -bool LaunchApp(const CommandLine& cl, -               bool wait, bool start_hidden, ProcessHandle* process_handle); +BASE_API bool LaunchApp(const CommandLine& cl, bool wait, bool start_hidden, +                        ProcessHandle* process_handle);  // Executes the application specified by |cl| and wait for it to exit. Stores  // the output (stdout) in |output|. Redirects stderr to /dev/null. Returns true  // on success (application launched and exited cleanly, with exit code  // indicating success). -bool GetAppOutput(const CommandLine& cl, std::string* output); +BASE_API bool GetAppOutput(const CommandLine& cl, std::string* output);  #if defined(OS_POSIX)  // A restricted version of |GetAppOutput()| which (a) clears the environment, @@ -323,22 +327,22 @@ class ProcessFilter {  // Returns the number of processes on the machine that are running from the  // given executable name.  If filter is non-null, then only processes selected  // by the filter will be counted. -int GetProcessCount(const FilePath::StringType& executable_name, -                    const ProcessFilter* filter); +BASE_API int GetProcessCount(const FilePath::StringType& executable_name, +                             const ProcessFilter* filter);  // Attempts to kill all the processes on the current machine that were launched  // from the given executable name, ending them with the given exit code.  If  // filter is non-null, then only processes selected by the filter are killed.  // Returns true if all processes were able to be killed off, false if at least  // one couldn't be killed. -bool KillProcesses(const FilePath::StringType& executable_name, int exit_code, -                   const ProcessFilter* filter); +BASE_API bool KillProcesses(const FilePath::StringType& executable_name, +                            int exit_code, const ProcessFilter* filter);  // Attempts to kill the process identified by the given process  // entry structure, giving it the specified exit code. If |wait| is true, wait  // for the process to be actually terminated before returning.  // Returns true if this is successful, false otherwise. -bool KillProcess(ProcessHandle process, int exit_code, bool wait); +BASE_API bool KillProcess(ProcessHandle process, int exit_code, bool wait);  #if defined(OS_POSIX)  // Attempts to kill the process group identified by |process_group_id|. Returns @@ -347,7 +351,7 @@ bool KillProcessGroup(ProcessHandle process_group_id);  #endif  #if defined(OS_WIN) -bool KillProcessById(ProcessId process_id, int exit_code, bool wait); +BASE_API bool KillProcessById(ProcessId process_id, int exit_code, bool wait);  #endif  // Get the termination status of the process by interpreting the @@ -358,38 +362,41 @@ bool KillProcessById(ProcessId process_id, int exit_code, bool wait);  // will only return a useful result the first time it is called after  // the child exits (because it will reap the child and the information  // will no longer be available). -TerminationStatus GetTerminationStatus(ProcessHandle handle, int* exit_code); +BASE_API TerminationStatus GetTerminationStatus(ProcessHandle handle, +                                                int* exit_code);  // Waits for process to exit. On POSIX systems, if the process hasn't been  // signaled then puts the exit code in |exit_code|; otherwise it's considered  // a failure. On Windows |exit_code| is always filled. Returns true on success,  // and closes |handle| in any case. -bool WaitForExitCode(ProcessHandle handle, int* exit_code); +BASE_API bool WaitForExitCode(ProcessHandle handle, int* exit_code);  // Waits for process to exit. If it did exit within |timeout_milliseconds|,  // then puts the exit code in |exit_code|, closes |handle|, and returns true.  // In POSIX systems, if the process has been signaled then |exit_code| is set  // to -1. Returns false on failure (the caller is then responsible for closing  // |handle|). -bool WaitForExitCodeWithTimeout(ProcessHandle handle, int* exit_code, -                                int64 timeout_milliseconds); +BASE_API bool WaitForExitCodeWithTimeout(ProcessHandle handle, int* exit_code, +                                         int64 timeout_milliseconds);  // Wait for all the processes based on the named executable to exit.  If filter  // is non-null, then only processes selected by the filter are waited on.  // Returns after all processes have exited or wait_milliseconds have expired.  // Returns true if all the processes exited, false otherwise. -bool WaitForProcessesToExit(const FilePath::StringType& executable_name, -                            int64 wait_milliseconds, -                            const ProcessFilter* filter); +BASE_API bool WaitForProcessesToExit( +    const FilePath::StringType& executable_name, +    int64 wait_milliseconds, +    const ProcessFilter* filter);  // Wait for a single process to exit. Return true if it exited cleanly within  // the given time limit. On Linux |handle| must be a child process, however  // on Mac and Windows it can be any process. -bool WaitForSingleProcess(ProcessHandle handle, int64 wait_milliseconds); +BASE_API bool WaitForSingleProcess(ProcessHandle handle, +                                   int64 wait_milliseconds);  // Returns true when |wait_milliseconds| have elapsed and the process  // is still running. -bool CrashAwareSleep(ProcessHandle handle, int64 wait_milliseconds); +BASE_API bool CrashAwareSleep(ProcessHandle handle, int64 wait_milliseconds);  // Waits a certain amount of time (can be 0) for all the processes with a given  // executable name to exit, then kills off any of them that are still around. @@ -397,16 +404,16 @@ bool CrashAwareSleep(ProcessHandle handle, int64 wait_milliseconds);  // on.  Killed processes are ended with the given exit code.  Returns false if  // any processes needed to be killed, true if they all exited cleanly within  // the wait_milliseconds delay. -bool CleanupProcesses(const FilePath::StringType& executable_name, -                      int64 wait_milliseconds, -                      int exit_code, -                      const ProcessFilter* filter); +BASE_API bool CleanupProcesses(const FilePath::StringType& executable_name, +                               int64 wait_milliseconds, +                               int exit_code, +                               const ProcessFilter* filter);  // This class provides a way to iterate through a list of processes on the  // current machine with a specified filter.  // To use, create an instance and then call NextProcessEntry() until it returns  // false. -class ProcessIterator { +class BASE_API ProcessIterator {   public:    typedef std::list<ProcessEntry> ProcessEntries; @@ -456,7 +463,7 @@ class ProcessIterator {  // on the current machine that were started from the given executable  // name.  To use, create an instance and then call NextProcessEntry()  // until it returns false. -class NamedProcessIterator : public ProcessIterator { +class BASE_API NamedProcessIterator : public ProcessIterator {   public:    NamedProcessIterator(const FilePath::StringType& executable_name,                         const ProcessFilter* filter); @@ -521,13 +528,13 @@ struct FreeMBytes {  };  // Convert a POSIX timeval to microseconds. -int64 TimeValToMicroseconds(const struct timeval& tv); +BASE_API int64 TimeValToMicroseconds(const struct timeval& tv);  // Provides performance metrics for a specified process (CPU usage, memory and  // IO counters). To use it, invoke CreateProcessMetrics() to get an instance  // for a specific process, then access the information with the different get  // methods. -class ProcessMetrics { +class BASE_API ProcessMetrics {   public:    ~ProcessMetrics(); @@ -628,7 +635,7 @@ class ProcessMetrics {  // Returns the memory commited by the system in KBytes.  // Returns 0 if it can't compute the commit charge. -size_t GetSystemCommitCharge(); +BASE_API size_t GetSystemCommitCharge();  // Enables low fragmentation heap (LFH) for every heaps of this process. This  // won't have any effect on heaps created after this function call. It will not @@ -636,7 +643,7 @@ size_t GetSystemCommitCharge();  // better to call this function early in initialization and again before  // entering the main loop.  // Note: Returns true on Windows 2000 without doing anything. -bool EnableLowFragmentationHeap(); +BASE_API bool EnableLowFragmentationHeap();  // Enables 'terminate on heap corruption' flag. Helps protect against heap  // overflow. Has no effect if the OS doesn't provide the necessary facility. @@ -652,16 +659,14 @@ malloc_zone_t* GetPurgeableZone();  #endif  #endif -#if defined(UNIT_TEST)  // Enables stack dump to console output on exception and signals.  // When enabled, the process will quit immediately. This is meant to be used in  // unit_tests only! -bool EnableInProcessStackDumping(); -#endif  // defined(UNIT_TEST) +BASE_API bool EnableInProcessStackDumping();  // If supported on the platform, and the user has sufficent rights, increase  // the current process's scheduling priority to a high priority. -void RaiseProcessToHighPriority(); +BASE_API void RaiseProcessToHighPriority();  #if defined(OS_MACOSX)  // Restore the default exception handler, setting it to Apple Crash Reporter diff --git a/base/scoped_native_library.h b/base/scoped_native_library.h index 28b29b3..151bb5f 100644 --- a/base/scoped_native_library.h +++ b/base/scoped_native_library.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_SCOPED_NATIVE_LIBRARY_H_  #pragma once +#include "base/base_api.h"  #include "base/native_library.h"  class FilePath; @@ -15,7 +16,7 @@ namespace base {  // A class which encapsulates a base::NativeLibrary object available only in a  // scope.  // This class automatically unloads the loaded library in its destructor. -class ScopedNativeLibrary { +class BASE_API ScopedNativeLibrary {   public:    // Initializes with a NULL library.    ScopedNativeLibrary(); diff --git a/base/sys_info.h b/base/sys_info.h index adfb250..1d2939e 100644 --- a/base/sys_info.h +++ b/base/sys_info.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_SYS_INFO_H_  #pragma once +#include "base/base_api.h"  #include "base/basictypes.h"  #include <string> @@ -14,7 +15,7 @@ class FilePath;  namespace base { -class SysInfo { +class BASE_API SysInfo {   public:    // Return the number of logical processors/cores on the current machine.    static int NumberOfProcessors(); diff --git a/base/threading/thread.h b/base/threading/thread.h index 379615d..034cb7d 100644 --- a/base/threading/thread.h +++ b/base/threading/thread.h @@ -8,6 +8,7 @@  #include <string> +#include "base/base_api.h"  #include "base/message_loop.h"  #include "base/message_loop_proxy.h"  #include "base/threading/platform_thread.h" @@ -25,7 +26,7 @@ namespace base {  //  (1) Thread::CleanUp()  //  (2) MessageLoop::~MessageLoop  //  (3.b)    MessageLoop::DestructionObserver::WillDestroyCurrentMessageLoop -class Thread : PlatformThread::Delegate { +class BASE_API Thread : PlatformThread::Delegate {   public:    struct Options {      Options() : message_loop_type(MessageLoop::TYPE_DEFAULT), stack_size(0) {} diff --git a/base/timer.h b/base/timer.h index ff14427..6fe826a 100644 --- a/base/timer.h +++ b/base/timer.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 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. @@ -47,6 +47,7 @@  // because they're flaky on the buildbot, but when you run them locally you  // should be able to tell the difference. +#include "base/base_api.h"  #include "base/logging.h"  #include "base/task.h"  #include "base/time.h" @@ -61,7 +62,7 @@ namespace base {  //  // This class exists to share code between BaseTimer<T> template instantiations.  // -class BaseTimer_Helper { +class BASE_API BaseTimer_Helper {   public:    // Stops the timer.    ~BaseTimer_Helper() { diff --git a/base/tracked_objects.h b/base/tracked_objects.h index 3994d80..99b5ed2 100644 --- a/base/tracked_objects.h +++ b/base/tracked_objects.h @@ -10,6 +10,7 @@  #include <string>  #include <vector> +#include "base/base_api.h"  #include "base/synchronization/lock.h"  #include "base/tracked.h"  #include "base/threading/thread_local_storage.h" @@ -156,7 +157,7 @@ namespace tracked_objects {  // For a specific thread, and a specific birth place, the collection of all  // death info (with tallies for each death thread, to prevent access conflicts).  class ThreadData; -class BirthOnThread { +class BASE_API BirthOnThread {   public:    explicit BirthOnThread(const Location& location); @@ -179,7 +180,7 @@ class BirthOnThread {  //------------------------------------------------------------------------------  // A class for accumulating counts of births (without bothering with a map<>). -class Births: public BirthOnThread { +class BASE_API Births: public BirthOnThread {   public:    explicit Births(const Location& location); @@ -207,7 +208,7 @@ class Births: public BirthOnThread {  // birthplace (fixed Location).  Used both on specific threads, and also used  // in snapshots when integrating assembled data. -class DeathData { +class BASE_API DeathData {   public:    // Default initializer.    DeathData() : count_(0), square_duration_(0) {} @@ -248,7 +249,7 @@ class DeathData {  // The source of this data was collected on many threads, and is asynchronously  // changing.  The data in this instance is not asynchronously changing. -class Snapshot { +class BASE_API Snapshot {   public:    // When snapshotting a full life cycle set (birth-to-death), use this:    Snapshot(const BirthOnThread& birth_on_thread, const ThreadData& death_thread, @@ -284,7 +285,7 @@ class Snapshot {  // items.  It protects the gathering under locks, so that it could be called via  // Posttask on any threads, or passed to all the target threads in parallel. -class DataCollector { +class BASE_API DataCollector {   public:    typedef std::vector<Snapshot> Collection; @@ -331,7 +332,7 @@ class DataCollector {  // Aggregation contains summaries (totals and subtotals) of groups of Snapshot  // instances to provide printing of these collections on a single line. -class Aggregation: public DeathData { +class BASE_API Aggregation: public DeathData {   public:    Aggregation();    ~Aggregation(); @@ -363,7 +364,7 @@ class Aggregation: public DeathData {  // instances within the groups (for detailed rendering of the instances in an  // aggregation). -class Comparator { +class BASE_API Comparator {   public:    // Selector enum is the token identifier for each parsed keyword, most of    // which specify a sort order. @@ -464,7 +465,7 @@ class Comparator {  // For each thread, we have a ThreadData that stores all tracking info generated  // on this thread.  This prevents the need for locking as data accumulates. -class ThreadData { +class BASE_API ThreadData {   public:    typedef std::map<Location, Births*> BirthMap;    typedef std::map<const Births*, DeathData> DeathMap; diff --git a/base/vlog.h b/base/vlog.h index 54e777f..0a55006 100644 --- a/base/vlog.h +++ b/base/vlog.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. @@ -10,13 +10,14 @@  #include <string>  #include <vector> +#include "base/base_api.h"  #include "base/basictypes.h"  #include "base/string_piece.h"  namespace logging {  // A helper class containing all the settings for vlogging. -class VlogInfo { +class BASE_API VlogInfo {   public:    static const int kDefaultVlogLevel; @@ -70,8 +71,8 @@ class VlogInfo {  //   "kh*n" matches "khn", "khan", or even "khaaaaan"  //   "/foo\bar" matches "/foo/bar", "\foo\bar", or "/foo\bar"  //     (disregarding C escaping rules) -bool MatchVlogPattern(const base::StringPiece& string, -                      const base::StringPiece& vlog_pattern); +BASE_API bool MatchVlogPattern(const base::StringPiece& string, +                               const base::StringPiece& vlog_pattern);  }  // namespace logging diff --git a/base/weak_ptr.h b/base/weak_ptr.h index 60da03f..8862517 100644 --- a/base/weak_ptr.h +++ b/base/weak_ptr.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. @@ -52,6 +52,7 @@  #define BASE_WEAK_PTR_H_  #pragma once +#include "base/base_api.h"  #include "base/logging.h"  #include "base/ref_counted.h"  #include "base/threading/non_thread_safe.h" @@ -62,7 +63,7 @@ namespace internal {  // These classes are part of the WeakPtr implementation.  // DO NOT USE THESE CLASSES DIRECTLY YOURSELF. -class WeakReference { +class BASE_API WeakReference {   public:    class Flag : public RefCounted<Flag>, public base::NonThreadSafe {     public: @@ -90,7 +91,7 @@ class WeakReference {    scoped_refptr<Flag> flag_;  }; -class WeakReferenceOwner { +class BASE_API WeakReferenceOwner {   public:    WeakReferenceOwner();    ~WeakReferenceOwner(); @@ -116,7 +117,7 @@ class WeakReferenceOwner {  // constructor by avoiding the need for a public accessor for ref_.  A  // WeakPtr<T> cannot access the private members of WeakPtr<U>, so this  // base class gives us a way to access ref_ in a protected fashion. -class WeakPtrBase { +class BASE_API WeakPtrBase {   public:    WeakPtrBase();    ~WeakPtrBase(); | 
