chrome/browser/safe_browsing/protocol_manager.cc
// We can only have one update or chunk request outstanding, but there may be
// multiple GetHash requests pending since we don't want to serialize them and
// slow down the user.
We can only have one update or chunk request outstanding, but there may be
multiple GetHash requests pending since we don't want to serialize them and
slow down the user.
We can only have one update or chunk request outstanding but there may be multiple GetHash requests pending since we don ' t want to serialize them and slow down the user .
void SafeBrowsingProtocolManager::GetFullHash(
    const std::vector<SBPrefix>& prefixes,
    FullHashCallback callback,
    bool is_download) {
  DCHECK(CalledOnValidThread());
  if (gethash_error_count_ && Time::Now() <= next_gethash_time_) {
    std::vector<SBFullHashResult> full_hashes;
    callback.Run(full_hashes, false);
    return;
  }
  GURL gethash_url = GetHashUrl();
  net::URLFetcher* fetcher = net::URLFetcher::Create(
      url_fetcher_id_++, gethash_url, net::URLFetcher::POST, this);
  hash_requests_[fetcher] = FullHashDetails(callback, is_download);
  std::string get_hash;
  SafeBrowsingProtocolParser parser;
  parser.FormatGetHash(prefixes, &get_hash);
  fetcher->SetLoadFlags(net::LOAD_DISABLE_CACHE);
  fetcher->SetRequestContext(request_context_getter_);
  fetcher->SetUploadData("text/plain", get_hash);
  fetcher->Start();
}
void SafeBrowsingProtocolManager :: GetFullHash ( const std :: vector < SBPrefix > & prefixes , FullHashCallback callback , bool is_download ) { DCHECK ( CalledOnValidThread ( ) ) ; if ( gethash_error_count_ && Time :: Now ( ) <= next_gethash_time_ ) { std :: vector < SBFullHashResult > full_hashes ; callback . Run ( full_hashes , false ) ; return ; } GURL gethash_url = GetHashUrl ( ) ; net :: URLFetcher * fetcher = net :: URLFetcher :: Create ( url_fetcher_id_ ++ , gethash_url , net :: URLFetcher :: POST , this ) ; hash_requests_ [ fetcher ] = FullHashDetails ( callback , is_download ) ; std :: string get_hash ; SafeBrowsingProtocolParser parser ; parser . FormatGetHash ( prefixes , & get_hash ) ; fetcher -> SetLoadFlags ( net :: LOAD_DISABLE_CACHE ) ; fetcher -> SetRequestContext ( request_context_getter_ ) ; fetcher -> SetUploadData ( " " , get_hash ) ; fetcher -> Start ( ) ; }
We can only have one update or chunk request outstanding, but there may be
multiple GetHash requests pending since we don't want to serialize them and
slow down the user.
We can only have one update or chunk request outstanding but there may be multiple GetHash requests pending since we don ' t want to serialize them and slow down the user .
// If we are in GetHash backoff, we need to check if we're past the next // allowed time. If we are, we can proceed with the request. If not, we are // required to return empty results (i.e. treat the page as safe).