diff options
77 files changed, 363 insertions, 369 deletions
diff --git a/base/at_exit.h b/base/at_exit.h index aecc892..0bc3466 100644 --- a/base/at_exit.h +++ b/base/at_exit.h @@ -21,7 +21,7 @@ namespace base { // AtExitManager object on the stack: // int main(...) { // base::AtExitManager exit_manager; -// +// // } // When the exit_manager object goes out of scope, all the registered // callbacks and singleton destructors will be called. diff --git a/base/at_exit_unittest.cc b/base/at_exit_unittest.cc index d80d68c..50dec04 100644 --- a/base/at_exit_unittest.cc +++ b/base/at_exit_unittest.cc @@ -52,7 +52,7 @@ TEST(AtExitTest, Basic) { base::AtExitManager::RegisterCallback(&IncrementTestCounter1, NULL); base::AtExitManager::RegisterCallback(&IncrementTestCounter2, NULL); base::AtExitManager::RegisterCallback(&IncrementTestCounter1, NULL); - + EXPECT_EQ(0, g_test_counter_1); EXPECT_EQ(0, g_test_counter_2); base::AtExitManager::ProcessCallbacksNow(); @@ -67,7 +67,7 @@ TEST(AtExitTest, LIFOOrder) { base::AtExitManager::RegisterCallback(&IncrementTestCounter1, NULL); base::AtExitManager::RegisterCallback(&ExpectCounter1IsZero, NULL); base::AtExitManager::RegisterCallback(&IncrementTestCounter2, NULL); - + EXPECT_EQ(0, g_test_counter_1); EXPECT_EQ(0, g_test_counter_2); base::AtExitManager::ProcessCallbacksNow(); diff --git a/base/atomicops_internals_x86_gcc.cc b/base/atomicops_internals_x86_gcc.cc index b7e1d926..600bc5f 100644 --- a/base/atomicops_internals_x86_gcc.cc +++ b/base/atomicops_internals_x86_gcc.cc @@ -70,7 +70,7 @@ static void AtomicOps_Internalx86CPUFeaturesInit() { // Opteron Rev E has a bug in which on very rare occasions a locked // instruction doesn't act as a read-acquire barrier if followed by a - // non-locked read-modify-write instruction. Rev F has this bug in + // non-locked read-modify-write instruction. Rev F has this bug in // pre-release versions, but not in versions released to customers, // so we test only for Rev E, which is family 15, model 32..63 inclusive. if (strcmp(vendor, "AuthenticAMD") == 0 && // AMD diff --git a/base/base_paths_mac.h b/base/base_paths_mac.h index 8f9e988..fa8a65e 100644 --- a/base/base_paths_mac.h +++ b/base/base_paths_mac.h @@ -5,8 +5,8 @@ #ifndef BASE_BASE_PATHS_MAC_H_ #define BASE_BASE_PATHS_MAC_H_ -// This file declares Mac-specific path keys for the base module. -// These can be used with the PathService to access various special +// This file declares Mac-specific path keys for the base module. +// These can be used with the PathService to access various special // directories and files. namespace base { diff --git a/base/base_paths_win.h b/base/base_paths_win.h index e323141..38cda803 100644 --- a/base/base_paths_win.h +++ b/base/base_paths_win.h @@ -5,8 +5,8 @@ #ifndef BASE_BASE_PATHS_WIN_H__ #define BASE_BASE_PATHS_WIN_H__ -// This file declares windows-specific path keys for the base module. -// These can be used with the PathService to access various special +// This file declares windows-specific path keys for the base module. +// These can be used with the PathService to access various special // directories and files. namespace base { diff --git a/base/clipboard.h b/base/clipboard.h index b9c58d1..631a516 100644 --- a/base/clipboard.h +++ b/base/clipboard.h @@ -62,7 +62,7 @@ class Clipboard { // CBF_BOOKMARK html char array // url char array // CBF_LINK html char array - // url char array + // url char array // CBF_FILES files char array representing multiple files. // Filenames are separated by null characters and // the final filename is double null terminated. diff --git a/base/clipboard_unittest.cc b/base/clipboard_unittest.cc index 18f5fbc..1015753 100644 --- a/base/clipboard_unittest.cc +++ b/base/clipboard_unittest.cc @@ -14,7 +14,7 @@ #if defined(OS_WIN) class ClipboardTest : public PlatformTest { - protected: + protected: virtual void SetUp() { message_loop_.reset(new MessageLoopForUI()); } diff --git a/base/clipboard_util.cc b/base/clipboard_util.cc index e56166d..3fd07c0 100644 --- a/base/clipboard_util.cc +++ b/base/clipboard_util.cc @@ -232,7 +232,10 @@ bool ClipboardUtil::GetUrl(IDataObject* data_object, PathIsUNCA(data.get()))) { char file_url[INTERNET_MAX_URL_LENGTH]; DWORD file_url_len = sizeof(file_url) / sizeof(file_url[0]); - if (SUCCEEDED(::UrlCreateFromPathA(data.get(), file_url, &file_url_len, 0))) { + if (SUCCEEDED(::UrlCreateFromPathA(data.get(), + file_url, + &file_url_len, + 0))) { *url = UTF8ToWide(file_url); title->assign(*url); success = true; @@ -396,7 +399,7 @@ bool ClipboardUtil::GetFileContents(IDataObject* data_object, * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ // Helper method for converting from text/html to MS CF_HTML. diff --git a/base/clipboard_win.cc b/base/clipboard_win.cc index c688f30..3efe7d36 100644 --- a/base/clipboard_win.cc +++ b/base/clipboard_win.cc @@ -283,7 +283,8 @@ void Clipboard::WriteBitmapFromSharedMemory(const char* bitmap_data, BITMAPINFO bm_info = {0}; bm_info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bm_info.bmiHeader.biWidth = size->width(); - bm_info.bmiHeader.biHeight = -size->height(); // Sets the vertical orientation + // Sets the vertical orientation. + bm_info.bmiHeader.biHeight = -size->height(); bm_info.bmiHeader.biPlanes = 1; bm_info.bmiHeader.biBitCount = 32; bm_info.bmiHeader.biCompression = BI_RGB; diff --git a/base/cpu.cc b/base/cpu.cc index ff02fb4..0fef897 100644 --- a/base/cpu.cc +++ b/base/cpu.cc @@ -26,7 +26,7 @@ void CPU::Initialize() { // __cpuid with an InfoType argument of 0 returns the number of // valid Ids in CPUInfo[0] and the CPU identification string in // the other three array elements. The CPU identification string is - // not in linear order. The code below arranges the information + // not in linear order. The code below arranges the information // in a human readable form. // // More info can be found here: diff --git a/base/file_path.cc b/base/file_path.cc index 406d018..b1bf687 100644 --- a/base/file_path.cc +++ b/base/file_path.cc @@ -291,7 +291,7 @@ std::wstring FilePath::ToWStringHack() const { FilePath FilePath::StripTrailingSeparators() const { FilePath new_path(path_); new_path.StripTrailingSeparatorsInternal(); - + return new_path; } diff --git a/base/file_version_info.h b/base/file_version_info.h index f31f38f..594bb92 100644 --- a/base/file_version_info.h +++ b/base/file_version_info.h @@ -81,7 +81,7 @@ class FileVersionInfo { VS_FIXEDFILEINFO* fixed_file_info_; #elif defined(OS_MACOSX) explicit FileVersionInfo(NSBundle *bundle); - + NSBundle *bundle_; #elif defined(OS_LINUX) FileVersionInfo(); diff --git a/base/gfx/jpeg_codec.cc b/base/gfx/jpeg_codec.cc index cd82ff3..47055dc 100644 --- a/base/gfx/jpeg_codec.cc +++ b/base/gfx/jpeg_codec.cc @@ -44,7 +44,9 @@ namespace { const static int initial_output_buffer_size = 8192; struct JpegEncoderState { - JpegEncoderState(std::vector<unsigned char>* o) : out(o), image_buffer_used(0) { + JpegEncoderState(std::vector<unsigned char>* o) + : out(o), + image_buffer_used(0) { } // Output buffer, of which 'image_buffer_used' bytes are actually used (this diff --git a/base/gfx/native_theme.cc b/base/gfx/native_theme.cc index 2faffd5..ff852c5 100644 --- a/base/gfx/native_theme.cc +++ b/base/gfx/native_theme.cc @@ -103,7 +103,7 @@ HRESULT NativeTheme::PaintButton(HDC hdc, if (handle && get_theme_content_rect_) { get_theme_content_rect_(handle, hdc, part_id, state_id, rect, rect); } else { - InflateRect(rect, -GetSystemMetrics(SM_CXEDGE), + InflateRect(rect, -GetSystemMetrics(SM_CXEDGE), -GetSystemMetrics(SM_CYEDGE)); } DrawFocusRect(hdc, rect); @@ -193,13 +193,14 @@ HRESULT NativeTheme::PaintScrollbarArrow(HDC hdc, return S_OK; } -HRESULT NativeTheme::PaintScrollbarTrack(HDC hdc, - int part_id, - int state_id, - int classic_state, - RECT* target_rect, - RECT* align_rect, - skia::PlatformCanvasWin* canvas) const { +HRESULT NativeTheme::PaintScrollbarTrack( + HDC hdc, + int part_id, + int state_id, + int classic_state, + RECT* target_rect, + RECT* align_rect, + skia::PlatformCanvasWin* canvas) const { HANDLE handle = GetThemeHandle(SCROLLBAR); if (handle && draw_theme_) return draw_theme_(handle, hdc, part_id, state_id, target_rect, NULL); diff --git a/base/gfx/png_codec_unittest.cc b/base/gfx/png_codec_unittest.cc index 0d9a44a..6b2b1ce 100644 --- a/base/gfx/png_codec_unittest.cc +++ b/base/gfx/png_codec_unittest.cc @@ -165,8 +165,10 @@ TEST(PNGCodec, StripAddAlpha) { // Encode RGBA data as RGB. std::vector<unsigned char> encoded; - EXPECT_TRUE(PNGEncoder::Encode(&original_rgba[0], PNGEncoder::FORMAT_RGBA, w, h, - w * 4, true, &encoded)); + EXPECT_TRUE(PNGEncoder::Encode(&original_rgba[0], + PNGEncoder::FORMAT_RGBA, + w, h, + w * 4, true, &encoded)); // Decode the RGB to RGBA. std::vector<unsigned char> decoded; @@ -182,8 +184,10 @@ TEST(PNGCodec, StripAddAlpha) { ASSERT_TRUE(original_rgba == decoded); // Encode RGBA to RGBA. - EXPECT_TRUE(PNGEncoder::Encode(&original_rgba[0], PNGEncoder::FORMAT_RGBA, w, h, - w * 4, false, &encoded)); + EXPECT_TRUE(PNGEncoder::Encode(&original_rgba[0], + PNGEncoder::FORMAT_RGBA, + w, h, + w * 4, false, &encoded)); // Decode the RGBA to RGB. EXPECT_TRUE(PNGDecoder::Decode(&encoded[0], encoded.size(), diff --git a/base/gfx/png_decoder.cc b/base/gfx/png_decoder.cc index ac0cd7d..a6d9a26b 100644 --- a/base/gfx/png_decoder.cc +++ b/base/gfx/png_decoder.cc @@ -293,7 +293,10 @@ bool PNGDecoder::Decode(const unsigned char* input, size_t input_size, png_set_progressive_read_fn(png_ptr, &state, &DecodeInfoCallback, &DecodeRowCallback, &DecodeEndCallback); - png_process_data(png_ptr, info_ptr, const_cast<unsigned char*>(input), input_size); + png_process_data(png_ptr, + info_ptr, + const_cast<unsigned char*>(input), + input_size); if (!state.done) { // Fed it all the data but the library didn't think we got all the data, so diff --git a/base/gfx/png_encoder.cc b/base/gfx/png_encoder.cc index b47db42..2130770 100755 --- a/base/gfx/png_encoder.cc +++ b/base/gfx/png_encoder.cc @@ -177,7 +177,8 @@ bool PNGEncoder::Encode(const unsigned char* input, ColorFormat format, if (!converter) { // No conversion needed, give the data directly to libpng. for (int y = 0; y < h; y ++) - png_write_row(png_ptr, const_cast<unsigned char*>(&input[y * row_byte_width])); + png_write_row(png_ptr, + const_cast<unsigned char*>(&input[y * row_byte_width])); } else { // Needs conversion using a separate buffer. unsigned char* row = new unsigned char[w * output_color_components]; diff --git a/base/hash_tables.h b/base/hash_tables.h index 0ac2651..aa53b39 100644 --- a/base/hash_tables.h +++ b/base/hash_tables.h @@ -7,7 +7,7 @@ // Deal with the differences between Microsoft and GNU implemenations // of hash_map. Allows all platforms to use |base::hash_map| and // |base::hash_set|. -// eg: +// eg: // base::hash_map<int> my_map; // base::hash_set<int> my_set; // diff --git a/base/icu_util.cc b/base/icu_util.cc index 2606545..dc8302c 100644 --- a/base/icu_util.cc +++ b/base/icu_util.cc @@ -20,18 +20,18 @@ #include "unicode/putil.h" #include "unicode/udata.h" -#define ICU_UTIL_DATA_FILE 0 -#define ICU_UTIL_DATA_SHARED 1 -#define ICU_UTIL_DATA_STATIC 2 +#define ICU_UTIL_DATA_FILE 0 +#define ICU_UTIL_DATA_SHARED 1 +#define ICU_UTIL_DATA_STATIC 2 #ifndef ICU_UTIL_DATA_IMPL #if defined(OS_WIN) -#define ICU_UTIL_DATA_IMPL ICU_UTIL_DATA_SHARED +#define ICU_UTIL_DATA_IMPL ICU_UTIL_DATA_SHARED #elif defined(OS_MACOSX) -#define ICU_UTIL_DATA_IMPL ICU_UTIL_DATA_STATIC +#define ICU_UTIL_DATA_IMPL ICU_UTIL_DATA_STATIC #elif defined(OS_LINUX) -#define ICU_UTIL_DATA_IMPL ICU_UTIL_DATA_FILE +#define ICU_UTIL_DATA_IMPL ICU_UTIL_DATA_FILE #endif #endif // ICU_UTIL_DATA_IMPL diff --git a/base/idle_timer.cc b/base/idle_timer.cc index 8f514b4..de980f1 100644 --- a/base/idle_timer.cc +++ b/base/idle_timer.cc @@ -35,22 +35,22 @@ bool OSIdleTimeSource(int32 *milliseconds_interval_since_last_event) { return false; } int32 last_input_time = lastInputInfo.dwTime; - - // Note: On Windows GetLastInputInfo returns a 32bit value which rolls over + + // Note: On Windows GetLastInputInfo returns a 32bit value which rolls over // ~49days. int32 current_time = GetTickCount(); int32 delta = current_time - last_input_time; // delta will go negative if we've been idle for 2GB of ticks. if (delta < 0) - delta = -delta; + delta = -delta; *milliseconds_interval_since_last_event = delta; return true; } #elif defined(OS_MACOSX) bool OSIdleTimeSource(int32 *milliseconds_interval_since_last_event) { - *milliseconds_interval_since_last_event = + *milliseconds_interval_since_last_event = CGEventSourceSecondsSinceLastEventType( - kCGEventSourceStateCombinedSessionState, + kCGEventSourceStateCombinedSessionState, kCGAnyInputEventType) * 1000.0; return true; } diff --git a/base/idletimer_unittest.cc b/base/idletimer_unittest.cc index 06166fb..07a8bbd 100644 --- a/base/idletimer_unittest.cc +++ b/base/idletimer_unittest.cc @@ -25,7 +25,7 @@ static Time mock_timer_started; bool MockIdleTimeSource(int32 *milliseconds_interval_since_last_event) { TimeDelta delta = Time::Now() - mock_timer_started; - *milliseconds_interval_since_last_event = + *milliseconds_interval_since_last_event = static_cast<int32>(delta.InMilliseconds()); return true; } @@ -112,7 +112,7 @@ TEST_F(IdleTimerTest, NoRepeatFlipIdleOnce) { base::OneShotTimer<TestFinishedTask> t1; t1.Start(TimeDelta::FromMilliseconds(10 * kSafeTestIntervalMs), &finish_task, &TestFinishedTask::Run); - + base::OneShotTimer<ResetIdleTask> t2; t2.Start(TimeDelta::FromMilliseconds(4 * kSafeTestIntervalMs), &reset_task, &ResetIdleTask::Run); @@ -138,7 +138,7 @@ TEST_F(IdleTimerTest, NoRepeatNotIdle) { base::OneShotTimer<TestFinishedTask> t; t.Start(TimeDelta::FromMilliseconds(10 * kSafeTestIntervalMs), &finish_task, &TestFinishedTask::Run); - + base::RepeatingTimer<ResetIdleTask> reset_timer; reset_timer.Start(TimeDelta::FromMilliseconds(50), &reset_task, &ResetIdleTask::Run); @@ -194,7 +194,7 @@ TEST_F(IdleTimerTest, RepeatIdleReset) { base::OneShotTimer<TestFinishedTask> t1; t1.Start(TimeDelta::FromMilliseconds(10 * kSafeTestIntervalMs), &finish_task, &TestFinishedTask::Run); - + base::OneShotTimer<ResetIdleTask> t2; t2.Start(TimeDelta::FromMilliseconds(5 * kSafeTestIntervalMs), &reset_task, &ResetIdleTask::Run); @@ -224,7 +224,7 @@ TEST_F(IdleTimerTest, RepeatNotIdle) { base::OneShotTimer<TestFinishedTask> t; t.Start(TimeDelta::FromMilliseconds(8 * kSafeTestIntervalMs), &finish_task, &TestFinishedTask::Run); - + base::RepeatingTimer<ResetIdleTask> reset_timer; reset_timer.Start(TimeDelta::FromMilliseconds(50), &reset_task, &ResetIdleTask::Run); diff --git a/base/lazy_instance.h b/base/lazy_instance.h index 10c7b31..1705b0f 100644 --- a/base/lazy_instance.h +++ b/base/lazy_instance.h @@ -27,7 +27,7 @@ // static LazyInstance<MyClass> my_instance(base::LINKER_INITIALIZED); // void SomeMethod() { // my_instance.Get().SomeMethod(); // MyClass::SomeMethod() -// +// // MyClass* ptr = my_instance.Pointer(); // ptr->DoDoDo(); // MyClass::DoDoDo // } diff --git a/base/lazy_instance_unittest.cc b/base/lazy_instance_unittest.cc index f447723..de5ea87 100644 --- a/base/lazy_instance_unittest.cc +++ b/base/lazy_instance_unittest.cc @@ -75,7 +75,7 @@ TEST(LazyInstanceTest, Basic) { lazy_logger.Pointer(); EXPECT_EQ(3, constructed_seq_.GetNext()); EXPECT_EQ(2, destructed_seq_.GetNext()); - } + } EXPECT_EQ(4, constructed_seq_.GetNext()); EXPECT_EQ(4, destructed_seq_.GetNext()); } diff --git a/base/logging.cc b/base/logging.cc index 4daefcd..a1e7cb2 100644 --- a/base/logging.cc +++ b/base/logging.cc @@ -40,7 +40,7 @@ typedef pthread_mutex_t* MutexHandle; #include "base/string_piece.h" #include "base/string_util.h" #include "base/sys_string_conversions.h" - + namespace logging { bool g_enable_dcheck = false; @@ -406,7 +406,8 @@ void LogMessage::Init(const char* file, int line) { } if (log_tickcount) stream_ << TickCount() << ':'; - stream_ << log_severity_names[severity_] << ":" << file << "(" << line << ")] "; + stream_ << log_severity_names[severity_] << ":" << file << + "(" << line << ")] "; message_start_ = stream_.tellp(); } @@ -452,16 +453,16 @@ LogMessage::~LogMessage() { // problems with unit tests, especially on the buildbots. fprintf(stderr, "%s", str_newline.c_str()); } - + // write to log file if (logging_destination != LOG_NONE && logging_destination != LOG_ONLY_TO_SYSTEM_DEBUG_LOG && InitializeLogFileHandle()) { - // we can have multiple threads and/or processes, so try to prevent them from - // clobbering each other's writes + // We can have multiple threads and/or processes, so try to prevent them + // from clobbering each other's writes. if (lock_log_file == LOCK_LOG_FILE) { // Ensure that the mutex is initialized in case the client app did not - // call InitLogging. This is not thread safe. See below + // call InitLogging. This is not thread safe. See below. InitLogMutex(); #if defined(OS_WIN) @@ -486,7 +487,11 @@ LogMessage::~LogMessage() { #if defined(OS_WIN) SetFilePointer(log_file, 0, 0, SEEK_END); DWORD num_written; - WriteFile(log_file, (void*)str_newline.c_str(), (DWORD)str_newline.length(), &num_written, NULL); + WriteFile(log_file, + static_cast<void*>(str_newline.c_str()), + static_cast<DWORD>(str_newline.length()), + &num_written, + NULL); #else fprintf(log_file, "%s", str_newline.c_str()); #endif diff --git a/base/mac_util_unittest.cc b/base/mac_util_unittest.cc index 03a90e9..538b1e7 100644 --- a/base/mac_util_unittest.cc +++ b/base/mac_util_unittest.cc @@ -14,7 +14,7 @@ typedef PlatformTest MacUtilTest; TEST_F(MacUtilTest, TestFSRef) { FSRef ref; std::string path("/System/Library"); - + ASSERT_TRUE(mac_util::FSRefFromPath(path, &ref)); EXPECT_EQ(path, mac_util::PathFromFSRef(ref)); } diff --git a/base/message_pump.h b/base/message_pump.h index 1a7770e..9ae9e2c 100644 --- a/base/message_pump.h +++ b/base/message_pump.h @@ -40,7 +40,7 @@ class MessagePump : public RefCountedThreadSafe<MessagePump> { }; virtual ~MessagePump() {} - + // The Run method is called to enter the message pump's run loop. // // Within the method, the message pump is responsible for processing native @@ -98,7 +98,7 @@ class MessagePump : public RefCountedThreadSafe<MessagePump> { // nested sub-loops that are "seemingly" outside the control of this message // pump. DoWork in particular must never be starved for time slices unless // it returns false (meaning it has run out of things to do). - // + // virtual void Run(Delegate* delegate) = 0; // Quit immediately from the most recently entered run loop. This method may diff --git a/base/message_pump_glib.cc b/base/message_pump_glib.cc index 602420e..c18bfd3 100644 --- a/base/message_pump_glib.cc +++ b/base/message_pump_glib.cc @@ -100,7 +100,7 @@ MessagePumpForUI::MessagePumpForUI() wakeup_pipe_write_ = fds[1]; wakeup_gpollfd_.fd = wakeup_pipe_read_; wakeup_gpollfd_.events = G_IO_IN; - + work_source_ = g_source_new(&WorkSourceFuncs, sizeof(WorkSource)); static_cast<WorkSource*>(work_source_)->pump = this; g_source_add_poll(work_source_, &wakeup_gpollfd_); diff --git a/base/message_pump_win.cc b/base/message_pump_win.cc index e415623..3af1991 100644 --- a/base/message_pump_win.cc +++ b/base/message_pump_win.cc @@ -383,7 +383,7 @@ bool MessagePumpForUI::ProcessPumpReplacementMessage() { int old_have_work = InterlockedExchange(&have_work_, 0); DCHECK(old_have_work); - // We don't need a special time slice if we didn't have_message to process. + // We don't need a special time slice if we didn't have_message to process. if (!have_message) return false; diff --git a/base/nss_init.cc b/base/nss_init.cc index df2beea..e3ce1ae 100644 --- a/base/nss_init.cc +++ b/base/nss_init.cc @@ -49,9 +49,9 @@ class NSSInitSingleton { // Explicitly enable exactly those ciphers with keys of at least 80 bits for (int i = 0; i < SSL_NumImplementedCiphers; i++) { SSLCipherSuiteInfo info; - if (SSL_GetCipherSuiteInfo(SSL_ImplementedCiphers[i], &info, + if (SSL_GetCipherSuiteInfo(SSL_ImplementedCiphers[i], &info, sizeof(info)) == SECSuccess) { - SSL_CipherPrefSetDefault(SSL_ImplementedCiphers[i], + SSL_CipherPrefSetDefault(SSL_ImplementedCiphers[i], (info.effectiveKeyBits >= 80)); } } @@ -59,7 +59,7 @@ class NSSInitSingleton { // Enable SSL SSL_OptionSetDefault(SSL_SECURITY, PR_TRUE); - // All other SSL options are set per-session by SSLClientSocket + // All other SSL options are set per-session by SSLClientSocket. } ~NSSInitSingleton() { diff --git a/base/object_watcher.cc b/base/object_watcher.cc index cad281f..d6bedcf 100644 --- a/base/object_watcher.cc +++ b/base/object_watcher.cc @@ -23,7 +23,7 @@ struct ObjectWatcher::Watch : public Task { // just get out of dodge. if (!watcher) return; - + DCHECK(did_signal); watcher->StopWatching(); @@ -78,7 +78,7 @@ bool ObjectWatcher::StopWatching() { // Make sure ObjectWatcher is used in a single-threaded fashion. DCHECK(watch_->origin_loop == MessageLoop::current()); - + // If DoneWaiting is in progress, we wait for it to finish. We know whether // DoneWaiting happened or not by inspecting the did_signal flag. if (!UnregisterWaitEx(watch_->wait_object, INVALID_HANDLE_VALUE)) { diff --git a/base/object_watcher.h b/base/object_watcher.h index 4660ce7..ea94efb 100644 --- a/base/object_watcher.h +++ b/base/object_watcher.h @@ -84,7 +84,8 @@ class ObjectWatcher : public MessageLoop::DestructionObserver { Watch* watch_; DISALLOW_COPY_AND_ASSIGN(ObjectWatcher); -}; +}; + } // namespace base #endif // BASE_OBJECT_WATCHER_H_ diff --git a/base/object_watcher_unittest.cc b/base/object_watcher_unittest.cc index 06e7284..f6b265e 100644 --- a/base/object_watcher_unittest.cc +++ b/base/object_watcher_unittest.cc @@ -43,7 +43,7 @@ void RunTest_BasicSignal(MessageLoop::Type message_loop_type) { bool ok = watcher.StartWatching(event, &delegate); EXPECT_TRUE(ok); EXPECT_EQ(event, watcher.GetWatchedObject()); - + SetEvent(event); MessageLoop::current()->Run(); @@ -63,7 +63,7 @@ void RunTest_BasicCancel(MessageLoop::Type message_loop_type) { QuitDelegate delegate; bool ok = watcher.StartWatching(event, &delegate); EXPECT_TRUE(ok); - + watcher.StopWatching(); CloseHandle(event); @@ -83,12 +83,12 @@ void RunTest_CancelAfterSet(MessageLoop::Type message_loop_type) { bool ok = watcher.StartWatching(event, &delegate); EXPECT_TRUE(ok); - + SetEvent(event); - + // Let the background thread do its business Sleep(30); - + watcher.StopWatching(); MessageLoop::current()->RunAllPending(); diff --git a/base/observer_list.h b/base/observer_list.h index 9f8b5cf..c3777b9 100644 --- a/base/observer_list.h +++ b/base/observer_list.h @@ -89,7 +89,7 @@ class ObserverList { // Remove an observer from the list. void RemoveObserver(ObserverType* obs) { - typename ListType::iterator it = + typename ListType::iterator it = std::find(observers_.begin(), observers_.end(), obs); if (it != observers_.end()) { if (notify_depth_) { diff --git a/base/observer_list_threadsafe.h b/base/observer_list_threadsafe.h index 70a76c8..dfff061 100644 --- a/base/observer_list_threadsafe.h +++ b/base/observer_list_threadsafe.h @@ -20,9 +20,9 @@ // OVERVIEW: // // A thread-safe container for a list of observers. -// This is similar to the observer_list (see observer_list.h), but it +// This is similar to the observer_list (see observer_list.h), but it // is more robust for multi-threaded situations. -// +// // The following use cases are supported: // * Observers can register for notifications from any thread. // Callbacks to the observer will occur on the same thread where @@ -42,14 +42,14 @@ // // IMPLEMENTATION NOTES // The ObserverListThreadSafe maintains an ObserverList for each thread -// which uses the ThreadSafeObserver. When Notifying the observers, +// which uses the ThreadSafeObserver. When Notifying the observers, // we simply call PostTask to each registered thread, and then each thread // will notify its regular ObserverList. // /////////////////////////////////////////////////////////////////////////////// template <class ObserverType> -class ObserverListThreadSafe : - public base::RefCountedThreadSafe<ObserverListThreadSafe<ObserverType> > { +class ObserverListThreadSafe + : public base::RefCountedThreadSafe<ObserverListThreadSafe<ObserverType> > { public: ObserverListThreadSafe() {} @@ -138,7 +138,7 @@ class ObserverListThreadSafe : MessageLoop* loop = (*it).first; ObserverList<ObserverType>* list = (*it).second; loop->PostTask(FROM_HERE, - NewRunnableMethod(this, + NewRunnableMethod(this, &ObserverListThreadSafe<ObserverType>:: template NotifyWrapper<Method, Params>, list, method)); } diff --git a/base/observer_list_unittest.cc b/base/observer_list_unittest.cc index 9413561..332de367f 100644 --- a/base/observer_list_unittest.cc +++ b/base/observer_list_unittest.cc @@ -110,7 +110,8 @@ class AddRemoveThread : public PlatformThread::Delegate, loop_->PostTask(FROM_HERE, factory_->NewRunnableMethod(&AddRemoveThread::AddTask)); loop_->Run(); - //LOG(ERROR) << "Loop 0x" << std::hex << loop_ << " done. " << count_observes_ << ", " << count_addtask_; + //LOG(ERROR) << "Loop 0x" << std::hex << loop_ << " done. " << + // count_observes_ << ", " << count_addtask_; delete loop_; loop_ = reinterpret_cast<MessageLoop*>(0xdeadbeef); delete this; @@ -231,7 +232,7 @@ TEST(ObserverListThreadSafeTest, BasicTest) { // from the observer list. Optionally, if cross_thread_notifies is set // to true, the observer threads will also trigger notifications to // all observers. -static void ThreadSafeObserverHarness(int num_threads, +static void ThreadSafeObserverHarness(int num_threads, bool cross_thread_notifies) { MessageLoop loop; diff --git a/base/path_service.cc b/base/path_service.cc index b47111f..0c3c3e2 100644 --- a/base/path_service.cc +++ b/base/path_service.cc @@ -119,7 +119,7 @@ struct PathData { } } }; - + static PathData* GetPathData() { return Singleton<PathData>::get(); } @@ -131,7 +131,7 @@ static PathData* GetPathData() { bool PathService::GetFromCache(int key, FilePath* result) { PathData* path_data = GetPathData(); AutoLock scoped_lock(path_data->lock); - + // check for a cached version PathMap::const_iterator it = path_data->cache.find(key); if (it != path_data->cache.end()) { diff --git a/base/path_service.h b/base/path_service.h index ca5e239..9806523 100644 --- a/base/path_service.h +++ b/base/path_service.h @@ -43,7 +43,8 @@ class PathService { // path specifies a directory that does not exist, the directory will be // created by this method. This method returns true if successful. // - // If the given path is relative, then it will be resolved against DIR_CURRENT. + // If the given path is relative, then it will be resolved against + // DIR_CURRENT. // // WARNING: Consumers of PathService::Get may expect paths to be constant // over the lifetime of the app, so this method should be used with caution. @@ -73,7 +74,7 @@ class PathService { private: static bool GetFromCache(int key, FilePath* path); static void AddToCache(int key, const FilePath& path); - + }; #endif // BASE_PATH_SERVICE_H__ diff --git a/base/platform_file.h b/base/platform_file.h index 2230b40..52484c7 100644 --- a/base/platform_file.h +++ b/base/platform_file.h @@ -34,8 +34,8 @@ enum PlatformFileFlags { PLATFORM_FILE_ASYNC = 256 }; -// Creates or open the given file. If PLATFORM_FILE_OPEN_ALWAYS is used, and -// |created| is provided, |created| will be set to true if the file was created +// Creates or open the given file. If PLATFORM_FILE_OPEN_ALWAYS is used, and +// |created| is provided, |created| will be set to true if the file was created // or to false in case the file was just opened. PlatformFile CreatePlatformFile(const std::wstring& name, int flags, diff --git a/base/platform_thread_posix.cc b/base/platform_thread_posix.cc index 4cca4e6..4cd56d9 100644 --- a/base/platform_thread_posix.cc +++ b/base/platform_thread_posix.cc @@ -23,7 +23,7 @@ void InitThreading(); static void* ThreadFunc(void* closure) { PlatformThread::Delegate* delegate = static_cast<PlatformThread::Delegate*>(closure); - delegate->ThreadMain(); + delegate->ThreadMain(); return NULL; } diff --git a/base/platform_thread_win.cc b/base/platform_thread_win.cc index d813bb72..236c00b 100644 --- a/base/platform_thread_win.cc +++ b/base/platform_thread_win.cc @@ -23,7 +23,7 @@ typedef struct tagTHREADNAME_INFO { DWORD __stdcall ThreadFunc(void* closure) { PlatformThread::Delegate* delegate = static_cast<PlatformThread::Delegate*>(closure); - delegate->ThreadMain(); + delegate->ThreadMain(); return NULL; } diff --git a/base/process_util.h b/base/process_util.h index 029f307..11c5e12 100644 --- a/base/process_util.h +++ b/base/process_util.h @@ -66,11 +66,11 @@ int GetCurrentProcId(); // Returns the ProcessHandle of the current process. ProcessHandle GetCurrentProcessHandle(); - + // Converts a PID to a process handle. This handle must be closed by // CloseProcessHandle when you are done with it. ProcessHandle OpenProcessHandle(int pid); - + // Closes the process handle opened by OpenProcessHandle. void CloseProcessHandle(ProcessHandle process); diff --git a/base/process_util_mac.mm b/base/process_util_mac.mm index de9cddf..f90070b 100644 --- a/base/process_util_mac.mm +++ b/base/process_util_mac.mm @@ -93,7 +93,7 @@ bool LaunchApp(const CommandLine& cl, } NamedProcessIterator::NamedProcessIterator(const std::wstring& executable_name, - const ProcessFilter* filter) + const ProcessFilter* filter) : executable_name_(executable_name), index_of_kinfo_proc_(0), filter_(filter) { @@ -102,7 +102,7 @@ NamedProcessIterator::NamedProcessIterator(const std::wstring& executable_name, // impossible. int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_UID, geteuid() }; - + // Since more processes could start between when we get the size and when // we get the list, we do a loop to keep trying until we get it. bool done = false; @@ -119,7 +119,7 @@ NamedProcessIterator::NamedProcessIterator(const std::wstring& executable_name, size_t num_of_kinfo_proc = len / sizeof(struct kinfo_proc); // Leave some spare room for process table growth (more could show up // between when we check and now) - num_of_kinfo_proc += 4; + num_of_kinfo_proc += 4; kinfo_procs_.resize(num_of_kinfo_proc); len = num_of_kinfo_proc * sizeof(struct kinfo_proc); // Load the list of processes @@ -139,7 +139,7 @@ NamedProcessIterator::NamedProcessIterator(const std::wstring& executable_name, } } } while (!done && (try_num++ < max_tries)); - + if (!done) { LOG(ERROR) << "failed to collect the process list in a few tries"; kinfo_procs_.resize(0); @@ -154,7 +154,7 @@ const ProcessEntry* NamedProcessIterator::NextProcessEntry() { do { result = CheckForNextProcess(); } while (result && !IncludeEntry()); - + if (result) { return &entry_; } diff --git a/base/process_util_win.cc b/base/process_util_win.cc index 34ec599..0ed5d86 100644 --- a/base/process_util_win.cc +++ b/base/process_util_win.cc @@ -198,7 +198,7 @@ bool DidProcessCrash(ProcessHandle handle) { // Warning, this is not generic code; it heavily depends on the way // the rest of the code kills a process. - + if (exitcode == PROCESS_END_NORMAL_TERMINATON || exitcode == PROCESS_END_KILLED_BY_USER || exitcode == PROCESS_END_PROCESS_WAS_HUNG || diff --git a/base/rand_util_win.cc b/base/rand_util_win.cc index 03176ab..13e8fb2 100644 --- a/base/rand_util_win.cc +++ b/base/rand_util_win.cc @@ -10,7 +10,7 @@ #include "base/logging.h" namespace { - + uint32 RandUint32() { uint32 number; CHECK(rand_s(&number) == 0); diff --git a/base/registry.cc b/base/registry.cc index 8e2e5e8..b5e5b32 100644 --- a/base/registry.cc +++ b/base/registry.cc @@ -3,12 +3,12 @@ // found in the LICENSE file. // All Rights Reserved. +#include "base/registry.h" + #include <assert.h> #include <shlwapi.h> #include <windows.h> -#include "base/registry.h" - #pragma comment(lib, "shlwapi.lib") // for SHDeleteKey // local types (see the same declarations in the header file) @@ -20,7 +20,6 @@ // RegistryValueIterator // - RegistryValueIterator::RegistryValueIterator(HKEY root_key, LPCTSTR folder_key) { LONG result = RegOpenKeyEx(root_key, folder_key, 0, KEY_READ, &key_); @@ -52,14 +51,12 @@ bool RegistryValueIterator::Valid() const { return key_ != NULL && index_ >= 0; } - void RegistryValueIterator::operator ++ () { // advance to the next entry in the folder --index_; Read(); } - bool RegistryValueIterator::Read() { if (Valid()) { DWORD ncount = sizeof(name_)/sizeof(*name_); @@ -76,11 +73,11 @@ bool RegistryValueIterator::Read() { return false; } - DWORD RegistryValueIterator::ValueCount() const { DWORD count = 0; - HRESULT result = ::RegQueryInfoKey(key_, NULL, 0, NULL, NULL, NULL, NULL, &count, NULL, NULL, NULL, NULL); + HRESULT result = ::RegQueryInfoKey(key_, NULL, 0, NULL, NULL, NULL, NULL, + &count, NULL, NULL, NULL, NULL); if (result != ERROR_SUCCESS) return 0; @@ -88,12 +85,10 @@ DWORD RegistryValueIterator::ValueCount() const { return count; } - // // RegistryKeyIterator // - RegistryKeyIterator::RegistryKeyIterator(HKEY root_key, LPCTSTR folder_key) { LONG result = RegOpenKeyEx(root_key, folder_key, 0, KEY_READ, &key_); @@ -125,14 +120,12 @@ bool RegistryKeyIterator::Valid() const { return key_ != NULL && index_ >= 0; } - void RegistryKeyIterator::operator ++ () { // advance to the next entry in the folder --index_; Read(); } - bool RegistryKeyIterator::Read() { if (Valid()) { DWORD ncount = sizeof(name_)/sizeof(*name_); @@ -147,7 +140,6 @@ bool RegistryKeyIterator::Read() { return false; } - DWORD RegistryKeyIterator::SubkeyCount() const { DWORD count = 0; @@ -160,13 +152,10 @@ DWORD RegistryKeyIterator::SubkeyCount() const { return count; } - // // RegKey // - - RegKey::RegKey(HKEY rootkey, const tchar* subkey, REGSAM access) : key_(NULL), watch_event_(0) { if (rootkey) { @@ -178,8 +167,6 @@ RegKey::RegKey(HKEY rootkey, const tchar* subkey, REGSAM access) else assert(!subkey); } - - void RegKey::Close() { StopWatching(); if (key_) { @@ -188,15 +175,11 @@ void RegKey::Close() { } } - - bool RegKey::Create(HKEY rootkey, const tchar* subkey, REGSAM access) { DWORD disposition_value; return CreateWithDisposition(rootkey, subkey, &disposition_value, access); } - - bool RegKey::CreateWithDisposition(HKEY rootkey, const tchar* subkey, DWORD* disposition, REGSAM access) { assert(rootkey && subkey && access && disposition); @@ -218,8 +201,6 @@ bool RegKey::CreateWithDisposition(HKEY rootkey, const tchar* subkey, else return true; } - - bool RegKey::Open(HKEY rootkey, const tchar* subkey, REGSAM access) { assert(rootkey && subkey && access); this->Close(); @@ -233,8 +214,6 @@ bool RegKey::Open(HKEY rootkey, const tchar* subkey, REGSAM access) { else return true; } - - bool RegKey::CreateKey(const tchar* name, REGSAM access) { assert(name && access); @@ -248,8 +227,6 @@ bool RegKey::CreateKey(const tchar* name, REGSAM access) { return (result == ERROR_SUCCESS); } - - bool RegKey::OpenKey(const tchar* name, REGSAM access) { assert(name && access); @@ -262,9 +239,6 @@ bool RegKey::OpenKey(const tchar* name, REGSAM access) { return (result == ERROR_SUCCESS); } - - - DWORD RegKey::ValueCount() { DWORD count = 0; HRESULT const result = ::RegQueryInfoKey(key_, NULL, 0, NULL, NULL, NULL, @@ -272,7 +246,6 @@ DWORD RegKey::ValueCount() { return (result != ERROR_SUCCESS) ? 0 : count; } - bool RegKey::ReadName(int index, tstr* name) { tchar buf[256]; DWORD bufsize = sizeof(buf)/sizeof(*buf); @@ -285,15 +258,12 @@ bool RegKey::ReadName(int index, tstr* name) { return true; } - bool RegKey::ValueExists(const tchar* name) { if (!key_) return false; const HRESULT result = RegQueryValueEx(key_, name, 0, NULL, NULL, NULL); return (result == ERROR_SUCCESS); } - - bool RegKey::ReadValue(const tchar* name, void* data, DWORD* dsize, DWORD* dtype) { if (!key_) return false; @@ -303,8 +273,6 @@ bool RegKey::ReadValue(const tchar* name, void* data, return (result == ERROR_SUCCESS); } - - bool RegKey::ReadValue(const tchar* name, tstr * value) { assert(value); static const size_t kMaxStringLength = 1024; // This is after expansion. @@ -332,8 +300,6 @@ bool RegKey::ReadValue(const tchar* name, tstr * value) { else return false; } - - bool RegKey::ReadValueDW(const tchar* name, DWORD * value) { assert(value); DWORD type = REG_DWORD, size = sizeof(DWORD), result = 0; @@ -346,33 +312,32 @@ bool RegKey::ReadValueDW(const tchar* name, DWORD * value) { else return false; } - - -bool RegKey::WriteValue(const tchar* name, const void * data, DWORD dsize, DWORD dtype) { +bool RegKey::WriteValue(const tchar* name, + const void * data, + DWORD dsize, + DWORD dtype) { assert(data); if (!key_) return false; - HRESULT const result = RegSetValueEx(key_, name, 0, - dtype, - reinterpret_cast<LPBYTE>(const_cast<void*>(data)), - dsize); + HRESULT const result = RegSetValueEx( + key_, + name, + 0, + dtype, + reinterpret_cast<LPBYTE>(const_cast<void*>(data)), + dsize); return (result == ERROR_SUCCESS); } - - bool RegKey::WriteValue(const tchar * name, const tchar * value) { return this->WriteValue(name, value, static_cast<DWORD>(sizeof(*value) * (_tcslen(value) + 1)), REG_SZ); } - bool RegKey::WriteValue(const tchar * name, DWORD value) { return this->WriteValue(name, &value, static_cast<DWORD>(sizeof(value)), REG_DWORD); } - - bool RegKey::DeleteKey(const tchar * name) { if (!key_) return false; return (ERROR_SUCCESS == SHDeleteKey(key_, name)); @@ -428,9 +393,10 @@ bool RegKey::HasChanged() { return false; } - // Register a COM object with the most usual properties. -bool RegisterCOMServer(const tchar* guid, const tchar* name, const tchar* path) { +bool RegisterCOMServer(const tchar* guid, + const tchar* name, + const tchar* path) { RegKey key(HKEY_CLASSES_ROOT, _T("CLSID"), KEY_WRITE); key.CreateKey(guid, KEY_WRITE); key.WriteValue(NULL, name); @@ -438,7 +404,7 @@ bool RegisterCOMServer(const tchar* guid, const tchar* name, const tchar* path) key.WriteValue(NULL, path); key.WriteValue(_T("ThreadingModel"), _T("Apartment")); return true; -}; +} bool RegisterCOMServer(const tchar* guid, const tchar* name, HINSTANCE module) { tchar module_path[MAX_PATH]; @@ -452,6 +418,3 @@ bool UnregisterCOMServer(const tchar* guid) { key.DeleteKey(guid); return true; } - -// LocalWords: RegKey - diff --git a/base/scoped_bstr_win.cc b/base/scoped_bstr_win.cc index 0e4efca..673aca2 100644 --- a/base/scoped_bstr_win.cc +++ b/base/scoped_bstr_win.cc @@ -47,7 +47,7 @@ BSTR ScopedBstr::Allocate(const wchar_t* wide_str) { } BSTR ScopedBstr::AllocateBytes(int bytes) { - Reset(SysAllocStringByteLen(NULL, bytes));
+ Reset(SysAllocStringByteLen(NULL, bytes)); return bstr_; } diff --git a/base/scoped_temp_dir.cc b/base/scoped_temp_dir.cc index 2eee63b..fd3245e 100644 --- a/base/scoped_temp_dir.cc +++ b/base/scoped_temp_dir.cc @@ -28,7 +28,7 @@ bool ScopedTempDir::CreateUniqueTempDir() { bool ScopedTempDir::Set(const FilePath& path) { DCHECK(path_.empty()); - if (!file_util::DirectoryExists(path) && + if (!file_util::DirectoryExists(path) && !file_util::CreateDirectory(path)) { return false; } diff --git a/base/shared_memory_unittest.cc b/base/shared_memory_unittest.cc index 4b1e088..75f3ae6 100644 --- a/base/shared_memory_unittest.cc +++ b/base/shared_memory_unittest.cc @@ -27,7 +27,7 @@ class MultipleThreadMain : public PlatformThread::Delegate { static void CleanUp() { SharedMemory memory; - memory.Delete(test_name_); + memory.Delete(s_test_name_); } // PlatformThread::Delegate interface. @@ -35,7 +35,7 @@ class MultipleThreadMain : public PlatformThread::Delegate { ScopedNSAutoreleasePool pool; // noop if not OSX const int kDataSize = 1024; SharedMemory memory; - bool rv = memory.Create(test_name_, false, true, kDataSize); + bool rv = memory.Create(s_test_name_, false, true, kDataSize); EXPECT_TRUE(rv); rv = memory.Map(kDataSize); EXPECT_TRUE(rv); @@ -54,12 +54,13 @@ class MultipleThreadMain : public PlatformThread::Delegate { private: int16 id_; - static const std::wstring test_name_; + static const wchar_t* const s_test_name_; DISALLOW_COPY_AND_ASSIGN(MultipleThreadMain); }; -const std::wstring MultipleThreadMain::test_name_ = L"SharedMemoryOpenThreadTest"; +const wchar_t* const MultipleThreadMain::s_test_name_ = + L"SharedMemoryOpenThreadTest"; // TODO(port): // This test requires the ability to pass file descriptors between processes. @@ -281,7 +282,7 @@ class SharedMemoryProcessTest : public MultiProcessTest { static void CleanUp() { SharedMemory memory; - memory.Delete(test_name_); + memory.Delete(s_test_name_); } static int TaskTestMain() { @@ -289,7 +290,7 @@ class SharedMemoryProcessTest : public MultiProcessTest { ScopedNSAutoreleasePool pool; // noop if not OSX const int kDataSize = 1024; SharedMemory memory; - bool rv = memory.Create(test_name_, false, true, kDataSize); + bool rv = memory.Create(s_test_name_, false, true, kDataSize); EXPECT_TRUE(rv); if (rv != true) errors++; @@ -314,10 +315,10 @@ class SharedMemoryProcessTest : public MultiProcessTest { } private: - static const std::wstring test_name_; + static const wchar_t* const s_test_name_; }; -const std::wstring SharedMemoryProcessTest::test_name_ = L"MPMem"; +const const wchar_t* const SharedMemoryProcessTest::s_test_name_ = L"MPMem"; TEST_F(SharedMemoryProcessTest, Tasks) { diff --git a/base/stack_container.h b/base/stack_container.h index 98c4ac0..1b325b1 100644 --- a/base/stack_container.h +++ b/base/stack_container.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef BASE_STACK_CONTAINER_H__ -#define BASE_STACK_CONTAINER_H__ +#ifndef BASE_STACK_CONTAINER_H_ +#define BASE_STACK_CONTAINER_H_ #include <string> #include <vector> @@ -71,7 +71,7 @@ class StackAllocator : public std::allocator<T> { }; // For the straight up copy c-tor, we can share storage. - StackAllocator(const StackAllocator<T, stack_capacity>& rhs) + StackAllocator(const StackAllocator<T, stack_capacity>& rhs) : source_(rhs.source_) { } @@ -80,9 +80,9 @@ class StackAllocator : public std::allocator<T> { // in the class _Container_base_aux_alloc_real (from <xutility>) // if the constructor does not exist. // For this constructor, we cannot share storage; there's - // no guarantee that the Source buffer of Ts is large enough + // no guarantee that the Source buffer of Ts is large enough // for Us. - // TODO: If we were fancy pants, perhaps we could share storage + // TODO: If we were fancy pants, perhaps we could share storage // iff sizeof(T) == sizeof(U). template<typename U, size_t other_capacity> StackAllocator(const StackAllocator<U, other_capacity>& other) @@ -245,10 +245,9 @@ class StackVector : public StackContainer< // Vectors are commonly indexed, which isn't very convenient even with // operator-> (using "->at()" does exception stuff we don't want). T& operator[](size_t i) { return this->container().operator[](i); } - const T& operator[](size_t i) const { - return this->container().operator[](i); + const T& operator[](size_t i) const { + return this->container().operator[](i); } }; -#endif // BASE_STACK_CONTAINER_H__ - +#endif // BASE_STACK_CONTAINER_H_ diff --git a/base/stats_table.cc b/base/stats_table.cc index a812b92..1a99b3c 100644 --- a/base/stats_table.cc +++ b/base/stats_table.cc @@ -347,7 +347,7 @@ void StatsTable::UnregisterThread(StatsTableTLSData* data) { } void StatsTable::SlotReturnFunction(void* data) { - // This is called by the TLS destructor, which on some platforms has + // This is called by the TLS destructor, which on some platforms has // already cleared the TLS info, so use the tls_data argument // rather than trying to fetch it ourselves. StatsTableTLSData* tls_data = static_cast<StatsTableTLSData*>(data); @@ -557,4 +557,3 @@ int* StatsTable::FindLocation(const char* name) { // Now we can find the location in the table. return table->GetLocation(counter, slot); } - diff --git a/base/string_util.cc b/base/string_util.cc index e7f6c33..a13f79f 100644 --- a/base/string_util.cc +++ b/base/string_util.cc @@ -1617,7 +1617,7 @@ bool ElideString(const std::wstring& input, int max_len, std::wstring* output) { output->assign(input); return false; } - + switch (max_len) { case 0: output->clear(); diff --git a/base/string_util_icu.cc b/base/string_util_icu.cc index 2287ba5..9036ce6 100644 --- a/base/string_util_icu.cc +++ b/base/string_util_icu.cc @@ -52,7 +52,7 @@ bool ReadUnicodeCharacter(const char16* src, int32 src_len, // Invalid surrogate pair. return false; } - + // Valid surrogate pair. *code_point = U16_GET_SUPPLEMENTARY(src[*char_index], src[*char_index + 1]); diff --git a/base/string_util_unittest.cc b/base/string_util_unittest.cc index 0ceb18f..8123151 100644 --- a/base/string_util_unittest.cc +++ b/base/string_util_unittest.cc @@ -122,10 +122,9 @@ TEST(StringUtilTest, IsStringUTF8) { EXPECT_TRUE(IsStringUTF8("a\xc2\x81\xe1\x80\xbf\xf1\x80\xa0\xbf")); EXPECT_TRUE(IsStringUTF8("\xef\xbb\xbf" "abc")); // UTF-8 BOM - - // surrogate code points + // surrogate code points EXPECT_FALSE(IsStringUTF8("\xed\xa0\x80\xed\xbf\xbf")); - EXPECT_FALSE(IsStringUTF8("\xed\xa0\x8f")); + EXPECT_FALSE(IsStringUTF8("\xed\xa0\x8f")); EXPECT_FALSE(IsStringUTF8("\xed\xbf\xbf")); // overlong sequences @@ -166,14 +165,14 @@ TEST(StringUtilTest, IsStringUTF8) { // Strings in legacy encodings. We can certainly make up strings // in a legacy encoding that are valid in UTF-8, but in real data, - // most of them are invalid as UTF-8. + // most of them are invalid as UTF-8. EXPECT_FALSE(IsStringUTF8("caf\xe9")); // cafe with U+00E9 in ISO-8859-1 EXPECT_FALSE(IsStringUTF8("\xb0\xa1\xb0\xa2")); // U+AC00, U+AC001 in EUC-KR EXPECT_FALSE(IsStringUTF8("\xa7\x41\xa6\x6e")); // U+4F60 U+597D in Big5 // "abc" with U+201[CD] in windows-125[0-8] - EXPECT_FALSE(IsStringUTF8("\x93" "abc\x94")); + EXPECT_FALSE(IsStringUTF8("\x93" "abc\x94")); // U+0639 U+064E U+0644 U+064E in ISO-8859-6 - EXPECT_FALSE(IsStringUTF8("\xd9\xee\xe4\xee")); + EXPECT_FALSE(IsStringUTF8("\xd9\xee\xe4\xee")); // U+03B3 U+03B5 U+03B9 U+03AC in ISO-8859-7 EXPECT_FALSE(IsStringUTF8("\xe3\xe5\xe9\xdC")); } diff --git a/base/sys_info_mac.cc b/base/sys_info_mac.cc index cd93ce9..2943066 100644 --- a/base/sys_info_mac.cc +++ b/base/sys_info_mac.cc @@ -9,7 +9,7 @@ namespace base { // static -void SysInfo::OperatingSystemVersionNumbers(int32 *major_version, +void SysInfo::OperatingSystemVersionNumbers(int32 *major_version, int32 *minor_version, int32 *bugfix_version) { static bool is_initialized = false; @@ -19,11 +19,11 @@ void SysInfo::OperatingSystemVersionNumbers(int32 *major_version, if (!is_initialized) { // Gestalt can't be called in the sandbox, so we cache its return value. - Gestalt(gestaltSystemVersionMajor, + Gestalt(gestaltSystemVersionMajor, reinterpret_cast<SInt32*>(&major_version_cached)); - Gestalt(gestaltSystemVersionMinor, + Gestalt(gestaltSystemVersionMinor, reinterpret_cast<SInt32*>(&minor_version_cached)); - Gestalt(gestaltSystemVersionBugFix, + Gestalt(gestaltSystemVersionBugFix, reinterpret_cast<SInt32*>(&bugfix_version_cached)); is_initialized = true; } diff --git a/base/sys_string_conversions.h b/base/sys_string_conversions.h index dbaa5a4..420c301 100644 --- a/base/sys_string_conversions.h +++ b/base/sys_string_conversions.h @@ -50,9 +50,9 @@ std::string SysWideToMultiByte(const std::wstring& wide, uint32 code_page); #endif // defined(OS_WIN) // Mac-specific ---------------------------------------------------------------- - + #if defined(OS_MACOSX) - + // Converts between STL strings and CFStringRefs/NSStrings. // Creates a string, and returns it with a refcount of 1. You are responsible @@ -77,7 +77,7 @@ string16 SysNSStringToUTF16(NSString* ref); std::wstring SysNSStringToWide(NSString* ref); #endif // defined(OS_MACOSX) - + } // namespace base #endif // BASE_SYS_STRING_CONVERSIONS_H_ diff --git a/base/sys_string_conversions_unittest.cc b/base/sys_string_conversions_unittest.cc index 41c52ba..2f6e3e4e 100644 --- a/base/sys_string_conversions_unittest.cc +++ b/base/sys_string_conversions_unittest.cc @@ -26,7 +26,8 @@ TEST(SysStrings, SysWideToUTF8) { // // This is what XP does, but Vista has different behavior, so we don't bother // verifying it: - //EXPECT_EQ("\xE4\xBD\xA0\xED\xA0\x80zyxw", SysWideToUTF8(L"\x4f60\xd800zyxw")); + //EXPECT_EQ("\xE4\xBD\xA0\xED\xA0\x80zyxw", + // SysWideToUTF8(L"\x4f60\xd800zyxw")); // Test embedded NULLs. std::wstring wide_null(L"a"); diff --git a/base/system_monitor_unittest.cc b/base/system_monitor_unittest.cc index 786a94d..7fe3d8f 100644 --- a/base/system_monitor_unittest.cc +++ b/base/system_monitor_unittest.cc @@ -1,79 +1,79 @@ -// Copyright (c) 2008 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 "base/system_monitor.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-class PowerTest : public base::SystemMonitor::PowerObserver {
- public:
- PowerTest()
- : battery_(false),
- power_state_changes_(0),
- suspends_(0),
- resumes_(0) {};
-
- // PowerObserver callbacks.
- void OnPowerStateChange(base::SystemMonitor*) { power_state_changes_++; };
- void OnSuspend(base::SystemMonitor*) { suspends_++; };
- void OnResume(base::SystemMonitor*) { resumes_++; };
-
- // Test status counts.
- bool battery() { return battery_; }
- int power_state_changes() { return power_state_changes_; }
- int suspends() { return suspends_; }
- int resumes() { return resumes_; }
-
- private:
- bool battery_; // Do we currently think we're on battery power.
- int power_state_changes_; // Count of OnPowerStateChange notifications.
- int suspends_; // Count of OnSuspend notifications.
- int resumes_; // Count of OnResume notifications.
-};
-
-TEST(SystemMonitor, PowerNotifications) {
- const int kObservers = 5;
-
- // Initialize a message loop for this to run on.
- MessageLoop loop;
- // Initialize time() since it registers as a SystemMonitor observer.
- base::Time now = base::Time::Now();
-
- base::SystemMonitor* monitor = base::SystemMonitor::Get();
- PowerTest test[kObservers];
- for (int index = 0; index < kObservers; ++index)
- monitor->AddObserver(&test[index]);
-
- // Send a bunch of power changes. Since the battery power hasn't
- // actually changed, we shouldn't get notifications.
- for (int index = 0; index < 5; index++) {
- monitor->ProcessPowerMessage(base::SystemMonitor::POWER_STATE_EVENT);
- EXPECT_EQ(test[0].power_state_changes(), 0);
- }
-
- // Sending resume when not suspended should have no effect.
- monitor->ProcessPowerMessage(base::SystemMonitor::RESUME_EVENT);
- loop.RunAllPending();
- EXPECT_EQ(test[0].resumes(), 0);
-
- // Pretend we suspended.
- monitor->ProcessPowerMessage(base::SystemMonitor::SUSPEND_EVENT);
- loop.RunAllPending();
- EXPECT_EQ(test[0].suspends(), 1);
-
- // Send a second suspend notification. This should be suppressed.
- monitor->ProcessPowerMessage(base::SystemMonitor::SUSPEND_EVENT);
- loop.RunAllPending();
- EXPECT_EQ(test[0].suspends(), 1);
-
- // Pretend we were awakened.
- monitor->ProcessPowerMessage(base::SystemMonitor::RESUME_EVENT);
- loop.RunAllPending();
- EXPECT_EQ(test[0].resumes(), 1);
-
- // Send a duplicate resume notification. This should be suppressed.
- monitor->ProcessPowerMessage(base::SystemMonitor::RESUME_EVENT);
- loop.RunAllPending();
- EXPECT_EQ(test[0].resumes(), 1);
-}
-
+// Copyright (c) 2008 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 "base/system_monitor.h" +#include "testing/gtest/include/gtest/gtest.h" + +class PowerTest : public base::SystemMonitor::PowerObserver { + public: + PowerTest() + : battery_(false), + power_state_changes_(0), + suspends_(0), + resumes_(0) {}; + + // PowerObserver callbacks. + void OnPowerStateChange(base::SystemMonitor*) { power_state_changes_++; }; + void OnSuspend(base::SystemMonitor*) { suspends_++; }; + void OnResume(base::SystemMonitor*) { resumes_++; }; + + // Test status counts. + bool battery() { return battery_; } + int power_state_changes() { return power_state_changes_; } + int suspends() { return suspends_; } + int resumes() { return resumes_; } + + private: + bool battery_; // Do we currently think we're on battery power. + int power_state_changes_; // Count of OnPowerStateChange notifications. + int suspends_; // Count of OnSuspend notifications. + int resumes_; // Count of OnResume notifications. +}; + +TEST(SystemMonitor, PowerNotifications) { + const int kObservers = 5; + + // Initialize a message loop for this to run on. + MessageLoop loop; + // Initialize time() since it registers as a SystemMonitor observer. + base::Time now = base::Time::Now(); + + base::SystemMonitor* monitor = base::SystemMonitor::Get(); + PowerTest test[kObservers]; + for (int index = 0; index < kObservers; ++index) + monitor->AddObserver(&test[index]); + + // Send a bunch of power changes. Since the battery power hasn't + // actually changed, we shouldn't get notifications. + for (int index = 0; index < 5; index++) { + monitor->ProcessPowerMessage(base::SystemMonitor::POWER_STATE_EVENT); + EXPECT_EQ(test[0].power_state_changes(), 0); + } + + // Sending resume when not suspended should have no effect. + monitor->ProcessPowerMessage(base::SystemMonitor::RESUME_EVENT); + loop.RunAllPending(); + EXPECT_EQ(test[0].resumes(), 0); + + // Pretend we suspended. + monitor->ProcessPowerMessage(base::SystemMonitor::SUSPEND_EVENT); + loop.RunAllPending(); + EXPECT_EQ(test[0].suspends(), 1); + + // Send a second suspend notification. This should be suppressed. + monitor->ProcessPowerMessage(base::SystemMonitor::SUSPEND_EVENT); + loop.RunAllPending(); + EXPECT_EQ(test[0].suspends(), 1); + + // Pretend we were awakened. + monitor->ProcessPowerMessage(base::SystemMonitor::RESUME_EVENT); + loop.RunAllPending(); + EXPECT_EQ(test[0].resumes(), 1); + + // Send a duplicate resume notification. This should be suppressed. + monitor->ProcessPowerMessage(base::SystemMonitor::RESUME_EVENT); + loop.RunAllPending(); + EXPECT_EQ(test[0].resumes(), 1); +} + diff --git a/base/system_monitor_win.cc b/base/system_monitor_win.cc index 7e07d7e..8bd604c 100644 --- a/base/system_monitor_win.cc +++ b/base/system_monitor_win.cc @@ -1,49 +1,49 @@ -// Copyright (c) 2008 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 "base/system_monitor.h"
-
-namespace base {
-
-void SystemMonitor::ProcessWmPowerBroadcastMessage(int event_id) {
- PowerEvent power_event;
- switch (event_id) {
- case PBT_APMPOWERSTATUSCHANGE: // The power status changed.
- power_event = POWER_STATE_EVENT;
- break;
- case PBT_APMRESUMEAUTOMATIC: // Non-user initiated resume from suspend.
- case PBT_APMRESUMESUSPEND: // User initiated resume from suspend.
- power_event = RESUME_EVENT;
- break;
- case PBT_APMSUSPEND: // System has been suspended.
- power_event = SUSPEND_EVENT;
- break;
- default:
- return;
-
- // Other Power Events:
- // PBT_APMBATTERYLOW - removed in Vista.
- // PBT_APMOEMEVENT - removed in Vista.
- // PBT_APMQUERYSUSPEND - removed in Vista.
- // PBT_APMQUERYSUSPENDFAILED - removed in Vista.
- // PBT_APMRESUMECRITICAL - removed in Vista.
- // PBT_POWERSETTINGCHANGE - user changed the power settings.
- }
- ProcessPowerMessage(power_event);
-}
-
-// Function to query the system to see if it is currently running on
-// battery power. Returns true if running on battery.
-bool SystemMonitor::IsBatteryPower() {
- SYSTEM_POWER_STATUS status;
- if (!GetSystemPowerStatus(&status)) {
- LOG(ERROR) << "GetSystemPowerStatus failed: " << GetLastError();
- return false;
- }
- return (status.ACLineStatus == 0);
-}
-
-
-
-} // namespace base
+// Copyright (c) 2008 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 "base/system_monitor.h" + +namespace base { + +void SystemMonitor::ProcessWmPowerBroadcastMessage(int event_id) { + PowerEvent power_event; + switch (event_id) { + case PBT_APMPOWERSTATUSCHANGE: // The power status changed. + power_event = POWER_STATE_EVENT; + break; + case PBT_APMRESUMEAUTOMATIC: // Non-user initiated resume from suspend. + case PBT_APMRESUMESUSPEND: // User initiated resume from suspend. + power_event = RESUME_EVENT; + break; + case PBT_APMSUSPEND: // System has been suspended. + power_event = SUSPEND_EVENT; + break; + default: + return; + + // Other Power Events: + // PBT_APMBATTERYLOW - removed in Vista. + // PBT_APMOEMEVENT - removed in Vista. + // PBT_APMQUERYSUSPEND - removed in Vista. + // PBT_APMQUERYSUSPENDFAILED - removed in Vista. + // PBT_APMRESUMECRITICAL - removed in Vista. + // PBT_POWERSETTINGCHANGE - user changed the power settings. + } + ProcessPowerMessage(power_event); +} + +// Function to query the system to see if it is currently running on +// battery power. Returns true if running on battery. +bool SystemMonitor::IsBatteryPower() { + SYSTEM_POWER_STATUS status; + if (!GetSystemPowerStatus(&status)) { + LOG(ERROR) << "GetSystemPowerStatus failed: " << GetLastError(); + return false; + } + return (status.ACLineStatus == 0); +} + + + +} // namespace base diff --git a/base/task.h b/base/task.h index 9053c1a..0aeea17 100644 --- a/base/task.h +++ b/base/task.h @@ -332,7 +332,9 @@ inline CancelableTask* NewRunnableMethod(T* object, Method method) { template <class T, class Method, class A> inline CancelableTask* NewRunnableMethod(T* object, Method method, const A& a) { - return new RunnableMethod<T, Method, Tuple1<A> >(object, method, MakeTuple(a)); + return new RunnableMethod<T, Method, Tuple1<A> >(object, + method, + MakeTuple(a)); } template <class T, class Method, class A, class B> @@ -435,7 +437,8 @@ inline CancelableTask* NewRunnableFunction(Function function, const A& a) { template <class Function, class A, class B> inline CancelableTask* NewRunnableFunction(Function function, const A& a, const B& b) { - return new RunnableFunction<Function, Tuple2<A, B> >(function, MakeTuple(a, b)); + return new RunnableFunction<Function, Tuple2<A, B> >(function, + MakeTuple(a, b)); } template <class Function, class A, class B, class C> @@ -587,7 +590,8 @@ struct Callback1 { }; template <class T, typename Arg1> -typename Callback1<Arg1>::Type* NewCallback(T* object, void (T::*method)(Arg1)) { +typename Callback1<Arg1>::Type* NewCallback(T* object, + void (T::*method)(Arg1)) { return new CallbackImpl<T, void (T::*)(Arg1), Tuple1<Arg1> >(object, method); } diff --git a/base/thread_collision_warner.h b/base/thread_collision_warner.h index 4a9481d..80781a8 100644 --- a/base/thread_collision_warner.h +++ b/base/thread_collision_warner.h @@ -35,7 +35,7 @@ // are synchronized somehow, it calls a method to "protect" from // a "protected" method // -// In this case the macro DFAKE_SCOPED_RECURSIVE_LOCK +// In this case the macro DFAKE_SCOPED_RECURSIVE_LOCK // has to be used, it checks that if a thread is inside the push/pop // then noone else is still inside the pop/push // @@ -223,7 +223,7 @@ class ThreadCollisionWarner { // call EnterSelf or Enter. void Leave(); - // This stores the thread id that is inside the critical section, if the + // This stores the thread id that is inside the critical section, if the // value is 0 then no thread is inside. volatile subtle::Atomic32 valid_thread_id_; diff --git a/base/thread_local.h b/base/thread_local.h index 7b3c3da..be387cf 100644 --- a/base/thread_local.h +++ b/base/thread_local.h @@ -5,7 +5,7 @@ // WARNING: Thread local storage is a bit tricky to get right. Please make // sure that this is really the proper solution for what you're trying to // achieve. Don't prematurely optimize, most likely you can just use a Lock. -// +// // These classes implement a warpper around the platform's TLS storage // mechanism. On construction, they will allocate a TLS slot, and free the // TLS slot on destruction. No memory management (creation or destruction) is diff --git a/base/thread_local_storage_posix.cc b/base/thread_local_storage_posix.cc index f40627d..80d5838 100644 --- a/base/thread_local_storage_posix.cc +++ b/base/thread_local_storage_posix.cc @@ -18,7 +18,7 @@ bool ThreadLocalStorage::Slot::Initialize(TLSDestructorFunc destructor) { NOTREACHED(); return false; } - + initialized_ = true; return true; } diff --git a/base/thread_local_unittest.cc b/base/thread_local_unittest.cc index 7cced70..9653e15 100644 --- a/base/thread_local_unittest.cc +++ b/base/thread_local_unittest.cc @@ -28,7 +28,7 @@ class SetThreadLocal : public ThreadLocalTesterBase { SetThreadLocal(TLPType* tlp, base::WaitableEvent* done) : ThreadLocalTesterBase(tlp, done), val_(NULL) { } ~SetThreadLocal() { } - + void set_value(ThreadLocalTesterBase* val) { val_ = val; } virtual void Run() { @@ -46,7 +46,7 @@ class GetThreadLocal : public ThreadLocalTesterBase { GetThreadLocal(TLPType* tlp, base::WaitableEvent* done) : ThreadLocalTesterBase(tlp, done), ptr_(NULL) { } ~GetThreadLocal() { } - + void set_ptr(ThreadLocalTesterBase** ptr) { ptr_ = ptr; } virtual void Run() { @@ -70,7 +70,7 @@ TEST(ThreadLocalTest, Pointer) { tp2.Start(); base::ThreadLocalPointer<ThreadLocalTesterBase> tlp; - + static ThreadLocalTesterBase* const kBogusPointer = reinterpret_cast<ThreadLocalTesterBase*>(0x1234); diff --git a/base/time_format.cc b/base/time_format.cc index 0cd4eba..cf2bbc8 100644 --- a/base/time_format.cc +++ b/base/time_format.cc @@ -17,7 +17,7 @@ std::wstring TimeFormat(const DateFormat* formatter, const Time& time) { DCHECK(formatter); UnicodeString date_string; - + formatter->format(static_cast<UDate>(time.ToDoubleT() * 1000), date_string); std::wstring output; bool success = UTF16ToWide(date_string.getBuffer(), date_string.length(), diff --git a/base/time_mac.cc b/base/time_mac.cc index 7f17c52..e5391be 100644 --- a/base/time_mac.cc +++ b/base/time_mac.cc @@ -62,11 +62,11 @@ void Time::Explode(bool is_local, Exploded* exploded) const { CFAbsoluteTime seconds = (static_cast<double>(us_) / kMicrosecondsPerSecond) - kCFAbsoluteTimeIntervalSince1970; - + scoped_cftyperef<CFTimeZoneRef> time_zone(is_local ? CFTimeZoneCopySystem() : NULL); CFGregorianDate date = CFAbsoluteTimeGetGregorianDate(seconds, time_zone); - + exploded->year = date.year; exploded->month = date.month; exploded->day_of_month = date.day; diff --git a/base/time_posix.cc b/base/time_posix.cc index 9532620..894d1af 100644 --- a/base/time_posix.cc +++ b/base/time_posix.cc @@ -4,8 +4,8 @@ #include "base/time.h" -#ifdef OS_MACOSX -#include <mach/mach_time.h> +#ifdef OS_MACOSX +#include <mach/mach_time.h> #endif #include <sys/time.h> #include <time.h> @@ -126,9 +126,9 @@ TimeTicks TimeTicks::Now() { uint64_t absolute_micro; #if defined(OS_MACOSX) - static mach_timebase_info_data_t timebase_info; - if (timebase_info.denom == 0) { - // Zero-initialization of statics guarantees that denom will be 0 before + static mach_timebase_info_data_t timebase_info; + if (timebase_info.denom == 0) { + // Zero-initialization of statics guarantees that denom will be 0 before // calling mach_timebase_info. mach_timebase_info will never set denom to // 0 as that would be invalid, so the zero-check can be used to determine // whether mach_timebase_info has already been called. This is diff --git a/base/time_win.cc b/base/time_win.cc index 06bf1d3..0174a90 100644 --- a/base/time_win.cc +++ b/base/time_win.cc @@ -23,8 +23,8 @@ // applications on the system. By default, precision is only 15.5ms. // Unfortunately, we don't want to call timeBeginPeriod because we don't // want to affect other applications. Further, on mobile platforms, use of -// faster multimedia timers can hurt battery life. See the intel -// article about this here: +// faster multimedia timers can hurt battery life. See the intel +// article about this here: // http://softwarecommunity.intel.com/articles/eng/1086.htm // // To work around all this, we're going to generally use timeGetTime(). We @@ -224,7 +224,7 @@ class NowSingleton : public base::SystemMonitor::PowerObserver { public: NowSingleton() : rollover_(TimeDelta::FromMilliseconds(0)), - last_seen_(0), + last_seen_(0), hi_res_clock_enabled_(false) { base::SystemMonitor* system = base::SystemMonitor::Get(); system->AddObserver(this); @@ -307,9 +307,9 @@ class NowSingleton : public base::SystemMonitor::PowerObserver { // retrieve and more reliable. class HighResNowSingleton { public: - HighResNowSingleton() + HighResNowSingleton() : ticks_per_microsecond_(0.0), - skew_(0) { + skew_(0) { InitializeClock(); // On Athlon X2 CPUs (e.g. model 15) QueryPerformanceCounter is diff --git a/base/time_win_unittest.cc b/base/time_win_unittest.cc index 4b63f6b..9244f7a5 100644 --- a/base/time_win_unittest.cc +++ b/base/time_win_unittest.cc @@ -175,9 +175,9 @@ TEST(TimeTicks, TimerPerformance) { }; // Cheating a bit here: assumes sizeof(TimeTicks) == sizeof(Time) // in order to create a single test case list. - COMPILE_ASSERT(sizeof(TimeTicks) == sizeof(Time), + COMPILE_ASSERT(sizeof(TimeTicks) == sizeof(Time), test_only_works_with_same_sizes); - TestCase cases[] = { + TestCase cases[] = { { reinterpret_cast<TestFunc>(Time::Now), "Time::Now" }, { TimeTicks::Now, "TimeTicks::Now" }, { TimeTicks::HighResNow, "TimeTicks::HighResNow" }, @@ -193,11 +193,11 @@ TEST(TimeTicks, TimerPerformance) { // Turning off the check for acceptible delays. Without this check, // the test really doesn't do much other than measure. But the // measurements are still useful for testing timers on various platforms. - // The reason to remove the check is because the tests run on many + // The reason to remove the check is because the tests run on many // buildbots, some of which are VMs. These machines can run horribly // slow, and there is really no value for checking against a max timer. //EXPECT_LT((stop - start).InMilliseconds(), kMaxTime); - printf("%s: %1.2fus per call\n", cases[test_case].description, + printf("%s: %1.2fus per call\n", cases[test_case].description, (stop - start).InMillisecondsF() * 1000 / kLoops); test_case++; } diff --git a/base/timer.cc b/base/timer.cc index 7fac059..2807606 100644 --- a/base/timer.cc +++ b/base/timer.cc @@ -8,9 +8,6 @@ namespace base { -//----------------------------------------------------------------------------- -// BaseTimer_Helper - void BaseTimer_Helper::OrphanDelayedTask() { if (delayed_task_) { delayed_task_->timer_ = NULL; diff --git a/base/timer.h b/base/timer.h index 706551f..dcabefa 100644 --- a/base/timer.h +++ b/base/timer.h @@ -170,7 +170,7 @@ class BaseTimer : public BaseTimer_Helper { self->delayed_task_ = NULL; // By now the delayed_task_ in the Timer does not point to us anymore. // We should reset our own timer_ because the Timer can not do this - // for us in its destructor. + // for us in its destructor. timer_ = NULL; } } diff --git a/base/timer_unittest.cc b/base/timer_unittest.cc index 4349245f..665a066 100644 --- a/base/timer_unittest.cc +++ b/base/timer_unittest.cc @@ -95,7 +95,7 @@ void RunTest_OneShotTimer_Cancel(MessageLoop::Type message_loop_type) { // Now start the timer. a->Start(); - + bool did_run_b = false; OneShotTimerTester b(&did_run_b); b.Start(); diff --git a/base/trace_event.cc b/base/trace_event.cc index 5b4ec36..400e878 100644 --- a/base/trace_event.cc +++ b/base/trace_event.cc @@ -102,22 +102,22 @@ bool TraceLog::OpenLogFile() { return true; } -void TraceLog::Trace(const std::string& name, +void TraceLog::Trace(const std::string& name, EventType type, const void* id, const std::wstring& extra, - const char* file, + const char* file, int line) { if (!enabled_) return; Trace(name, type, id, WideToUTF8(extra), file, line); } -void TraceLog::Trace(const std::string& name, +void TraceLog::Trace(const std::string& name, EventType type, const void* id, const std::string& extra, - const char* file, + const char* file, int line) { if (!enabled_) return; @@ -129,7 +129,7 @@ void TraceLog::Trace(const std::string& name, #endif TimeDelta delta = tick - trace_start_time_; int64 usec = delta.InMicroseconds(); - std::string msg = + std::string msg = StringPrintf("{'pid':'0x%lx', 'tid':'0x%lx', 'type':'%s', " "'name':'%s', 'id':'0x%lx', 'extra':'%s', 'file':'%s', " "'line_number':'%d', 'usec_begin': %I64d},\n", diff --git a/base/trace_event.h b/base/trace_event.h index 02f6128..d2b6ef1 100644 --- a/base/trace_event.h +++ b/base/trace_event.h @@ -86,17 +86,17 @@ class TraceLog { static void StopTracing(); // Log a trace event of (name, type, id) with the optional extra string. - void Trace(const std::string& name, + void Trace(const std::string& name, EventType type, const void* id, const std::wstring& extra, - const char* file, + const char* file, int line); - void Trace(const std::string& name, + void Trace(const std::string& name, EventType type, const void* id, const std::string& extra, - const char* file, + const char* file, int line); private: diff --git a/base/tuple.h b/base/tuple.h index 8fd965f..7cb77fb 100644 --- a/base/tuple.h +++ b/base/tuple.h @@ -394,7 +394,9 @@ inline void DispatchToMethod(ObjT* obj, Method method, const Tuple1<A>& arg) { } template<class ObjT, class Method, class A, class B> -inline void DispatchToMethod(ObjT* obj, Method method, const Tuple2<A, B>& arg) { +inline void DispatchToMethod(ObjT* obj, + Method method, + const Tuple2<A, B>& arg) { (obj->*method)(arg.a, arg.b); } @@ -478,7 +480,9 @@ inline void DispatchToFunction(Function function, // Dispatchers with 0 out param (as a Tuple0). template <class ObjT, class Method> -inline void DispatchToMethod(ObjT* obj, Method method, const Tuple0& arg, Tuple0*) { +inline void DispatchToMethod(ObjT* obj, + Method method, + const Tuple0& arg, Tuple0*) { (obj->*method)(); } @@ -488,12 +492,16 @@ inline void DispatchToMethod(ObjT* obj, Method method, const A& arg, Tuple0*) { } template <class ObjT, class Method, class A> -inline void DispatchToMethod(ObjT* obj, Method method, const Tuple1<A>& arg, Tuple0*) { +inline void DispatchToMethod(ObjT* obj, + Method method, + const Tuple1<A>& arg, Tuple0*) { (obj->*method)(arg.a); } template<class ObjT, class Method, class A, class B> -inline void DispatchToMethod(ObjT* obj, Method method, const Tuple2<A, B>& arg, Tuple0*) { +inline void DispatchToMethod(ObjT* obj, + Method method, + const Tuple2<A, B>& arg, Tuple0*) { (obj->*method)(arg.a, arg.b); } diff --git a/base/values_unittest.cc b/base/values_unittest.cc index ac1ff44..dd2121f 100644 --- a/base/values_unittest.cc +++ b/base/values_unittest.cc @@ -63,7 +63,7 @@ TEST(ValuesTest, List) { mixed_list->Set(2, Value::CreateRealValue(88.8)); mixed_list->Set(3, Value::CreateStringValue("foo")); ASSERT_EQ(4u, mixed_list->GetSize()); - + Value *value = NULL; bool bool_value = false; int int_value = 0; @@ -373,7 +373,7 @@ TEST(ValuesTest, DeepCopy) { ASSERT_TRUE(copy_dict->Get(L"wstring", ©_wstring)); ASSERT_TRUE(copy_wstring); ASSERT_NE(copy_wstring, original_wstring); - ASSERT_TRUE(copy_wstring->IsType(Value::TYPE_STRING)); + ASSERT_TRUE(copy_wstring->IsType(Value::TYPE_STRING)); ASSERT_TRUE(copy_wstring->GetAsString(©_string_value)); ASSERT_TRUE(copy_wstring->GetAsString(©_wstring_value)); ASSERT_EQ(std::string("peek-a-boo"), copy_string_value); diff --git a/base/version.cc b/base/version.cc index 1fe5cb4..a40388d 100644 --- a/base/version.cc +++ b/base/version.cc @@ -62,7 +62,7 @@ const std::string Version::GetString() const { bool Version::InitFromString(const std::string& version_str) { std::vector<std::string> numbers; SplitString(version_str, '.', &numbers); - for (std::vector<std::string>::iterator i = numbers.begin(); + for (std::vector<std::string>::iterator i = numbers.begin(); i != numbers.end(); ++i) { int num; if (!StringToInt(*i, &num)) diff --git a/base/word_iterator.cc b/base/word_iterator.cc index 1e59a2f..7af07f5 100644 --- a/base/word_iterator.cc +++ b/base/word_iterator.cc @@ -54,7 +54,7 @@ bool WordIterator::Init() { int32_t destLength; u_strFromWCS(&chars_[0], chars_.size(), &destLength, string_.data(), string_.length(), &error); - + iter_ = ubrk_open(break_type, NULL, &chars_[0], destLength, &status); #endif if (U_FAILURE(status)) { |