diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-20 20:23:04 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-20 20:23:04 +0000 |
commit | 8436e747836cb3a0e50c59509467921dcc08479c (patch) | |
tree | 77fe3ad591c2bb48301bdd36d23b4e79636a0b88 | |
parent | c6e0757e159c474f847fa4bb6c2bbbf1e1effce2 (diff) | |
download | chromium_src-8436e747836cb3a0e50c59509467921dcc08479c.zip chromium_src-8436e747836cb3a0e50c59509467921dcc08479c.tar.gz chromium_src-8436e747836cb3a0e50c59509467921dcc08479c.tar.bz2 |
Convert LOG(INFO) to VLOG(1) - chrome/service/.
Also, remove some extra {}s, simplify some code, and fix argument wrapping per style guide.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3940001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63257 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/service/cloud_print/cloud_print_proxy_backend.cc | 50 | ||||
-rw-r--r-- | chrome/service/cloud_print/printer_job_handler.cc | 125 | ||||
-rw-r--r-- | chrome/service/service_process.cc | 7 |
3 files changed, 95 insertions, 87 deletions
diff --git a/chrome/service/cloud_print/cloud_print_proxy_backend.cc b/chrome/service/cloud_print/cloud_print_proxy_backend.cc index 2d0a46f..d30160e 100644 --- a/chrome/service/cloud_print/cloud_print_proxy_backend.cc +++ b/chrome/service/cloud_print/cloud_print_proxy_backend.cc @@ -307,7 +307,7 @@ void CloudPrintProxyBackend::Core::DoInitializeWithToken( const std::string cloud_print_xmpp_token, const std::string email, const std::string& proxy_id) { DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop()); - LOG(INFO) << "CP_PROXY: Starting proxy, id: " << proxy_id; + VLOG(1) << "CP_PROXY: Starting proxy, id: " << proxy_id; print_system_ = cloud_print::PrintSystem::CreateInstance(print_system_settings_.get()); @@ -362,7 +362,7 @@ void CloudPrintProxyBackend::Core::EndRegistration() { void CloudPrintProxyBackend::Core::DoShutdown() { DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop()); - LOG(INFO) << "CP_PROXY: Shutdown proxy, id: " << proxy_id_; + VLOG(1) << "CP_PROXY: Shutdown proxy, id: " << proxy_id_; if (print_server_watcher_ != NULL) print_server_watcher_->StopWatching(); @@ -485,14 +485,14 @@ void CloudPrintProxyBackend::Core::RegisterNextPrinter() { void CloudPrintProxyBackend::Core::HandlePrinterNotification( const std::string& printer_id) { DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop()); - LOG(INFO) << "CP_PROXY: Handle printer notification, id: " << printer_id; + VLOG(1) << "CP_PROXY: Handle printer notification, id: " << printer_id; JobHandlerMap::iterator index = job_handler_map_.find(printer_id); if (index != job_handler_map_.end()) index->second->NotifyJobAvailable(); } void CloudPrintProxyBackend::Core::PollForJobs() { - LOG(INFO) << "CP_PROXY: Polling for jobs."; + VLOG(1) << "CP_PROXY: Polling for jobs."; DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop()); for (JobHandlerMap::iterator index = job_handler_map_.begin(); index != job_handler_map_.end(); index++) { @@ -500,9 +500,8 @@ void CloudPrintProxyBackend::Core::PollForJobs() { } job_poll_scheduled_ = false; // If we don't have notifications, poll again after a while. - if (!notifications_enabled_) { + if (!notifications_enabled_) ScheduleJobPoll(); - } } void CloudPrintProxyBackend::Core::ScheduleJobPoll() { @@ -601,9 +600,8 @@ void CloudPrintProxyBackend::Core::HandlePrinterListResponse( } } - if (!succeeded) { + if (!succeeded) HandleServerError(NewRunnableMethod(this, &Core::GetRegisteredPrinters)); - } } void CloudPrintProxyBackend::Core::InitJobHandlerForPrinter( @@ -613,8 +611,8 @@ void CloudPrintProxyBackend::Core::InitJobHandlerForPrinter( PrinterJobHandler::PrinterInfoFromCloud printer_info_cloud; printer_data->GetString(kIdValue, &printer_info_cloud.printer_id); DCHECK(!printer_info_cloud.printer_id.empty()); - LOG(INFO) << "CP_PROXY: Init job handler for printer id: " << - printer_info_cloud.printer_id; + VLOG(1) << "CP_PROXY: Init job handler for printer id: " + << printer_info_cloud.printer_id; JobHandlerMap::iterator index = job_handler_map_.find( printer_info_cloud.printer_id); // We might already have a job handler for this printer @@ -638,9 +636,8 @@ void CloudPrintProxyBackend::Core::InitJobHandlerForPrinter( std::vector<std::string> tag_parts; base::SplitStringDontTrim(tag, '=', &tag_parts); DCHECK(tag_parts.size() == 2); - if (tag_parts.size() == 2) { + if (tag_parts.size() == 2) printer_info_cloud.tags_hash = tag_parts[1]; - } } } } @@ -658,8 +655,8 @@ void CloudPrintProxyBackend::Core::HandleRegisterPrinterResponse( int response_code, const ResponseCookies& cookies, const std::string& data) { DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop()); - LOG(INFO) << "CP_PROXY: Handle register printer response, code: " << - response_code; + VLOG(1) << "CP_PROXY: Handle register printer response, code: " + << response_code; Task* next_task = NewRunnableMethod(this, &CloudPrintProxyBackend::Core::RegisterNextPrinter); @@ -675,9 +672,8 @@ void CloudPrintProxyBackend::Core::HandleRegisterPrinterResponse( DCHECK(printer_list); if (printer_list) { DictionaryValue* printer_data = NULL; - if (printer_list->GetDictionary(0, &printer_data)) { + if (printer_list->GetDictionary(0, &printer_data)) InitJobHandlerForPrinter(printer_data); - } } } server_error_count_ = 0; @@ -690,7 +686,7 @@ void CloudPrintProxyBackend::Core::HandleRegisterPrinterResponse( void CloudPrintProxyBackend::Core::HandleServerError(Task* task_to_retry) { DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop()); - LOG(INFO) << "CP_PROXY: Server error."; + VLOG(1) << "CP_PROXY: Server error."; CloudPrintHelpers::HandleServerError( &server_error_count_, -1, kMaxRetryInterval, kBaseRetryInterval, task_to_retry, NULL); @@ -699,17 +695,15 @@ void CloudPrintProxyBackend::Core::HandleServerError(Task* task_to_retry) { bool CloudPrintProxyBackend::Core::RemovePrinterFromList( const std::string& printer_name) { DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop()); - bool ret = false; for (cloud_print::PrinterList::iterator index = printer_list_.begin(); index != printer_list_.end(); index++) { if (0 == base::strcasecmp(index->printer_name.c_str(), printer_name.c_str())) { index = printer_list_.erase(index); - ret = true; - break; + return true; } } - return ret; + return false; } void CloudPrintProxyBackend::Core::OnNotificationStateChange( @@ -733,11 +727,10 @@ void CloudPrintProxyBackend::Core::OnNotificationStateChange( void CloudPrintProxyBackend::Core::OnIncomingNotification( const IncomingNotificationData& notification_data) { DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop()); - LOG(INFO) << "CP_PROXY: Incoming notification."; + VLOG(1) << "CP_PROXY: Incoming notification."; if (0 == base::strcasecmp(push_notifications_channel_.c_str(), - notification_data.service_url.c_str())) { + notification_data.service_url.c_str())) HandlePrinterNotification(notification_data.service_specific_data); - } } void CloudPrintProxyBackend::Core::OnOutgoingNotification() {} @@ -745,24 +738,23 @@ void CloudPrintProxyBackend::Core::OnOutgoingNotification() {} // cloud_print::PrinterChangeNotifier::Delegate implementation void CloudPrintProxyBackend::Core::OnPrinterAdded() { DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop()); - if (request_.get()) { + if (request_.get()) new_printers_available_ = true; - } else { + else StartRegistration(); - } } // PrinterJobHandler::Delegate implementation void CloudPrintProxyBackend::Core::OnPrinterJobHandlerShutdown( PrinterJobHandler* job_handler, const std::string& printer_id) { DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop()); - LOG(INFO) << "CP_PROXY: Printer job handle shutdown, id " << printer_id; + VLOG(1) << "CP_PROXY: Printer job handle shutdown, id " << printer_id; job_handler_map_.erase(printer_id); } void CloudPrintProxyBackend::Core::OnAuthError() { DCHECK(MessageLoop::current() == backend_->core_thread_.message_loop()); - LOG(INFO) << "CP_PROXY: Auth Error"; + VLOG(1) << "CP_PROXY: Auth Error"; backend_->frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, &Core::NotifyAuthenticationFailed)); } diff --git a/chrome/service/cloud_print/printer_job_handler.cc b/chrome/service/cloud_print/printer_job_handler.cc index e0b38be..bdc5801 100644 --- a/chrome/service/cloud_print/printer_job_handler.cc +++ b/chrome/service/cloud_print/printer_job_handler.cc @@ -70,9 +70,9 @@ void PrinterJobHandler::Reset() { } void PrinterJobHandler::Start() { - LOG(INFO) << "CP_PROXY: Start printer job handler, id: " << - printer_info_cloud_.printer_id << ", task in progress: " << - task_in_progress_; + VLOG(1) << "CP_PROXY: Start printer job handler, id: " + << printer_info_cloud_.printer_id + << ", task in progress: " << task_in_progress_; if (task_in_progress_) { // Multiple Starts can get posted because of multiple notifications // We want to ignore the other ones that happen when a task is in progress. @@ -110,8 +110,8 @@ void PrinterJobHandler::Start() { } void PrinterJobHandler::Stop() { - LOG(INFO) << "CP_PROXY: Stop printer job handler, id: " << - printer_info_cloud_.printer_id; + VLOG(1) << "CP_PROXY: Stop printer job handler, id: " + << printer_info_cloud_.printer_id; task_in_progress_ = false; Reset(); if (HavePendingTasks()) { @@ -121,9 +121,9 @@ void PrinterJobHandler::Stop() { } void PrinterJobHandler::NotifyJobAvailable() { - LOG(INFO) << "CP_PROXY: Notify job available, id: " << - printer_info_cloud_.printer_id << ", task in progress: " << - task_in_progress_; + VLOG(1) << "CP_PROXY: Notify job available, id: " + << printer_info_cloud_.printer_id + << ", task in progress: " << task_in_progress_; server_job_available_ = true; if (!task_in_progress_) { MessageLoop::current()->PostTask( @@ -132,8 +132,8 @@ void PrinterJobHandler::NotifyJobAvailable() { } bool PrinterJobHandler::UpdatePrinterInfo() { - LOG(INFO) << "CP_PROXY: Update printer info, id: " << - printer_info_cloud_.printer_id; + VLOG(1) << "CP_PROXY: Update printer info, id: " + << printer_info_cloud_.printer_id; // We need to update the parts of the printer info that have changed // (could be printer name, description, status or capabilities). cloud_print::PrinterBasicInfo printer_info; @@ -215,11 +215,14 @@ bool PrinterJobHandler::UpdatePrinterInfo() { // URLFetcher::Delegate implementation. void PrinterJobHandler::OnURLFetchComplete( - const URLFetcher* source, const GURL& url, const URLRequestStatus& status, - int response_code, const ResponseCookies& cookies, + const URLFetcher* source, + const GURL& url, + const URLRequestStatus& status, + int response_code, + const ResponseCookies& cookies, const std::string& data) { - LOG(INFO) << "CP_PROXY: Printer job handler, OnURLFetchComplete, url: " << - url << ", response code: " << response_code; + VLOG(1) << "CP_PROXY: Printer job handler, OnURLFetchComplete, url: " << url + << ", response code: " << response_code; // If there was an auth error, we are done. if (RC_FORBIDDEN == response_code) { OnAuthError(); @@ -288,12 +291,15 @@ void PrinterJobHandler::OnJobChanged() { } bool PrinterJobHandler::HandlePrinterUpdateResponse( - const URLFetcher* source, const GURL& url, const URLRequestStatus& status, - int response_code, const ResponseCookies& cookies, + const URLFetcher* source, + const GURL& url, + const URLRequestStatus& status, + int response_code, + const ResponseCookies& cookies, const std::string& data) { bool ret = false; - LOG(INFO) << "CP_PROXY: Handle printer update response, id: " << - printer_info_cloud_.printer_id; + VLOG(1) << "CP_PROXY: Handle printer update response, id: " + << printer_info_cloud_.printer_id; // If there was a network error or a non-200 response (which, for our purposes // is the same as a network error), we want to retry. if (status.is_success() && (response_code == 200)) { @@ -317,12 +323,15 @@ bool PrinterJobHandler::HandlePrinterUpdateResponse( } bool PrinterJobHandler::HandlePrinterDeleteResponse( - const URLFetcher* source, const GURL& url, const URLRequestStatus& status, - int response_code, const ResponseCookies& cookies, + const URLFetcher* source, + const GURL& url, + const URLRequestStatus& status, + int response_code, + const ResponseCookies& cookies, const std::string& data) { bool ret = false; - LOG(INFO) << "CP_PROXY: Handler printer delete response, id: " << - printer_info_cloud_.printer_id; + VLOG(1) << "CP_PROXY: Handler printer delete response, id: " + << printer_info_cloud_.printer_id; // If there was a network error or a non-200 response (which, for our purposes // is the same as a network error), we want to retry. if (status.is_success() && (response_code == 200)) { @@ -346,11 +355,14 @@ bool PrinterJobHandler::HandlePrinterDeleteResponse( } bool PrinterJobHandler::HandleJobMetadataResponse( - const URLFetcher* source, const GURL& url, const URLRequestStatus& status, - int response_code, const ResponseCookies& cookies, + const URLFetcher* source, + const GURL& url, + const URLRequestStatus& status, + int response_code, + const ResponseCookies& cookies, const std::string& data) { - LOG(INFO) << "CP_PROXY: Handle job metadata response, id: " << - printer_info_cloud_.printer_id; + VLOG(1) << "CP_PROXY: Handle job metadata response, id: " + << printer_info_cloud_.printer_id; // If there was a network error or a non-200 response (which, for our purposes // is the same as a network error), we want to retry. if (!status.is_success() || (response_code != 200)) { @@ -399,8 +411,8 @@ bool PrinterJobHandler::HandlePrintTicketResponse( const URLFetcher* source, const GURL& url, const URLRequestStatus& status, int response_code, const ResponseCookies& cookies, const std::string& data) { - LOG(INFO) << "CP_PROXY: Handle print ticket response, id: " << - printer_info_cloud_.printer_id; + VLOG(1) << "CP_PROXY: Handle print ticket response, id: " + << printer_info_cloud_.printer_id; // If there was a network error or a non-200 response (which, for our purposes // is the same as a network error), we want to retry. if (!status.is_success() || (response_code != 200)) { @@ -428,8 +440,8 @@ bool PrinterJobHandler::HandlePrintDataResponse(const URLFetcher* source, int response_code, const ResponseCookies& cookies, const std::string& data) { - LOG(INFO) << "CP_PROXY: Handle print data response, id: " << - printer_info_cloud_.printer_id; + VLOG(1) << "CP_PROXY: Handle print data response, id: " + << printer_info_cloud_.printer_id; // If there was a network error or a non-200 response (which, for our purposes // is the same as a network error), we want to retry. if (!status.is_success() || (response_code != 200)) { @@ -458,8 +470,7 @@ bool PrinterJobHandler::HandlePrintDataResponse(const URLFetcher* source, } void PrinterJobHandler::StartPrinting() { - LOG(INFO) << "CP_PROXY: Start printing, id: " << - printer_info_cloud_.printer_id; + VLOG(1) << "CP_PROXY: Start printing, id: " << printer_info_cloud_.printer_id; // We are done with the request object for now. request_.reset(); if (!shutting_down_) { @@ -475,15 +486,15 @@ void PrinterJobHandler::StartPrinting() { } void PrinterJobHandler::JobFailed(PrintJobError error) { - LOG(INFO) << "CP_PROXY: Job failed, id: " << printer_info_cloud_.printer_id; + VLOG(1) << "CP_PROXY: Job failed, id: " << printer_info_cloud_.printer_id; if (!shutting_down_) { UpdateJobStatus(cloud_print::PRINT_JOB_STATUS_ERROR, error); } } void PrinterJobHandler::JobSpooled(cloud_print::PlatformJobId local_job_id) { - LOG(INFO) << "CP_PROXY: Job spooled, printer id: " << - printer_info_cloud_.printer_id << ", job id: " << local_job_id; + VLOG(1) << "CP_PROXY: Job spooled, printer id: " + << printer_info_cloud_.printer_id << ", job id: " << local_job_id; if (!shutting_down_) { local_job_id_ = local_job_id; UpdateJobStatus(cloud_print::PRINT_JOB_STATUS_IN_PROGRESS, SUCCESS); @@ -492,8 +503,8 @@ void PrinterJobHandler::JobSpooled(cloud_print::PlatformJobId local_job_id) { } void PrinterJobHandler::Shutdown() { - LOG(INFO) << "CP_PROXY: Printer job handler shutdown, id: " << - printer_info_cloud_.printer_id; + VLOG(1) << "CP_PROXY: Printer job handler shutdown, id: " + << printer_info_cloud_.printer_id; Reset(); shutting_down_ = true; while (!job_status_updater_list_.empty()) { @@ -508,8 +519,8 @@ void PrinterJobHandler::Shutdown() { } void PrinterJobHandler::HandleServerError(const GURL& url) { - LOG(INFO) << "CP_PROXY: Handle server error, printer id: " << - printer_info_cloud_.printer_id << ", url: " << url; + VLOG(1) << "CP_PROXY: Handle server error, printer id: " + << printer_info_cloud_.printer_id << ", url: " << url; Task* task_to_retry = NewRunnableMethod(this, &PrinterJobHandler::FetchURL, url); Task* task_on_give_up = NewRunnableMethod(this, next_failure_handler_); @@ -520,12 +531,12 @@ void PrinterJobHandler::HandleServerError(const GURL& url) { void PrinterJobHandler::UpdateJobStatus(cloud_print::PrintJobStatus status, PrintJobError error) { - LOG(INFO) << "CP_PROXY: Update job status, id: " << - printer_info_cloud_.printer_id; + VLOG(1) << "CP_PROXY: Update job status, id: " + << printer_info_cloud_.printer_id; if (!shutting_down_) { if (!job_details_.job_id_.empty()) { - LOG(INFO) << "CP_PROXY: Updating status, jod id: " << - job_details_.job_id_ << ", status: " << status; + VLOG(1) << "CP_PROXY: Updating status, job id: " << job_details_.job_id_ + << ", status: " << status; ResponseHandler response_handler = NULL; if (error == SUCCESS) { @@ -546,11 +557,14 @@ void PrinterJobHandler::UpdateJobStatus(cloud_print::PrintJobStatus status, } bool PrinterJobHandler::HandleSuccessStatusUpdateResponse( - const URLFetcher* source, const GURL& url, const URLRequestStatus& status, - int response_code, const ResponseCookies& cookies, + const URLFetcher* source, + const GURL& url, + const URLRequestStatus& status, + int response_code, + const ResponseCookies& cookies, const std::string& data) { - LOG(INFO) << "CP_PROXY: Handle success status update response, id: " << - printer_info_cloud_.printer_id; + VLOG(1) << "CP_PROXY: Handle success status update response, id: " + << printer_info_cloud_.printer_id; // If there was a network error or a non-200 response (which, for our purposes // is the same as a network error), we want to retry. if (!status.is_success() || (response_code != 200)) { @@ -578,11 +592,14 @@ bool PrinterJobHandler::HandleSuccessStatusUpdateResponse( } bool PrinterJobHandler::HandleFailureStatusUpdateResponse( - const URLFetcher* source, const GURL& url, const URLRequestStatus& status, - int response_code, const ResponseCookies& cookies, + const URLFetcher* source, + const GURL& url, + const URLRequestStatus& status, + int response_code, + const ResponseCookies& cookies, const std::string& data) { - LOG(INFO) << "CP_PROXY: Handle failure status update response, id: " << - printer_info_cloud_.printer_id; + VLOG(1) << "CP_PROXY: Handle failure status update response, id: " + << printer_info_cloud_.printer_id; // If there was a network error or a non-200 response (which, for our purposes // is the same as a network error), we want to retry. if (!status.is_success() || (response_code != 200)) { @@ -596,8 +613,8 @@ bool PrinterJobHandler::HandleFailureStatusUpdateResponse( void PrinterJobHandler::MakeServerRequest(const GURL& url, ResponseHandler response_handler, FailureHandler failure_handler) { - LOG(INFO) << "CP_PROXY: Printer job handle, make server request, id: " << - printer_info_cloud_.printer_id << ", url: " << url; + VLOG(1) << "CP_PROXY: Printer job handle, make server request, id: " + << printer_info_cloud_.printer_id << ", url: " << url; if (!shutting_down_) { server_error_count_ = 0; // Set up the next response handler @@ -608,7 +625,7 @@ void PrinterJobHandler::MakeServerRequest(const GURL& url, } void PrinterJobHandler::FetchURL(const GURL& url) { - LOG(INFO) << "CP_PROXY: PrinterJobHandler::FetchURL, url: " << url; + VLOG(1) << "CP_PROXY: PrinterJobHandler::FetchURL, url: " << url; request_.reset(new URLFetcher(url, URLFetcher::GET, this)); CloudPrintHelpers::PrepCloudPrintRequest(request_.get(), auth_token_); request_->Start(); diff --git a/chrome/service/service_process.cc b/chrome/service/service_process.cc index b4ae481..673eed4 100644 --- a/chrome/service/service_process.cc +++ b/chrome/service/service_process.cc @@ -105,7 +105,7 @@ bool ServiceProcess::Initialize(MessageLoop* message_loop, GetCloudPrintProxy()->EnableForUser(lsid); } - LOG(INFO) << "Starting Service Process IPC Server"; + VLOG(1) << "Starting Service Process IPC Server"; ipc_server_.reset(new ServiceIPCServer(GetServiceProcessChannelName())); ipc_server_->Init(); @@ -374,9 +374,8 @@ void ServiceProcess::LoadChromotingConfig() { user_data_dir.Append(FILE_PATH_LITERAL(".ChromotingConfig.json")); chromoting_config_ = new remoting::JsonHostConfig( chromoting_config_path, file_thread_->message_loop_proxy()); - if (!chromoting_config_->Read()) { - LOG(INFO) << "Failed to read chromoting config file."; - } + if (!chromoting_config_->Read()) + VLOG(1) << "Failed to read chromoting config file."; } void ServiceProcess::OnChromotingHostShutdown() { |