| OLD | NEW | 
|    1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |    1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
|    2 // Use of this source code is governed by a BSD-style license that can be |    2 // Use of this source code is governed by a BSD-style license that can be | 
|    3 // found in the LICENSE file. |    3 // found in the LICENSE file. | 
|    4  |    4  | 
|    5 #include "chrome/browser/prerender/prerender_contents.h" |    5 #include "chrome/browser/prerender/prerender_contents.h" | 
|    6  |    6  | 
|    7 #include <stddef.h> |    7 #include <stddef.h> | 
|    8  |    8  | 
|    9 #include <algorithm> |  | 
|   10 #include <functional> |    9 #include <functional> | 
|   11 #include <utility> |   10 #include <utility> | 
|   12  |   11  | 
|   13 #include "base/bind.h" |   12 #include "base/bind.h" | 
|   14 #include "base/memory/ptr_util.h" |   13 #include "base/memory/ptr_util.h" | 
|   15 #include "base/process/process_metrics.h" |   14 #include "base/process/process_metrics.h" | 
 |   15 #include "base/stl_util.h" | 
|   16 #include "base/strings/utf_string_conversions.h" |   16 #include "base/strings/utf_string_conversions.h" | 
|   17 #include "build/build_config.h" |   17 #include "build/build_config.h" | 
|   18 #include "chrome/browser/chrome_notification_types.h" |   18 #include "chrome/browser/chrome_notification_types.h" | 
|   19 #include "chrome/browser/history/history_tab_helper.h" |   19 #include "chrome/browser/history/history_tab_helper.h" | 
|   20 #include "chrome/browser/prerender/prerender_field_trial.h" |   20 #include "chrome/browser/prerender/prerender_field_trial.h" | 
|   21 #include "chrome/browser/prerender/prerender_final_status.h" |   21 #include "chrome/browser/prerender/prerender_final_status.h" | 
|   22 #include "chrome/browser/prerender/prerender_handle.h" |   22 #include "chrome/browser/prerender/prerender_handle.h" | 
|   23 #include "chrome/browser/prerender/prerender_manager.h" |   23 #include "chrome/browser/prerender/prerender_manager.h" | 
|   24 #include "chrome/browser/prerender/prerender_manager_factory.h" |   24 #include "chrome/browser/prerender/prerender_manager_factory.h" | 
|   25 #include "chrome/browser/prerender/prerender_resource_throttle.h" |   25 #include "chrome/browser/prerender/prerender_resource_throttle.h" | 
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  516  |  516  | 
|  517 bool PrerenderContents::Matches( |  517 bool PrerenderContents::Matches( | 
|  518     const GURL& url, |  518     const GURL& url, | 
|  519     const SessionStorageNamespace* session_storage_namespace) const { |  519     const SessionStorageNamespace* session_storage_namespace) const { | 
|  520   // TODO(davidben): Remove any consumers that pass in a NULL |  520   // TODO(davidben): Remove any consumers that pass in a NULL | 
|  521   // session_storage_namespace and only test with matches. |  521   // session_storage_namespace and only test with matches. | 
|  522   if (session_storage_namespace && |  522   if (session_storage_namespace && | 
|  523       session_storage_namespace_id_ != session_storage_namespace->id()) { |  523       session_storage_namespace_id_ != session_storage_namespace->id()) { | 
|  524     return false; |  524     return false; | 
|  525   } |  525   } | 
|  526   return std::find(alias_urls_.begin(), alias_urls_.end(), url) != |  526   return base::ContainsValue(alias_urls_, url); | 
|  527          alias_urls_.end(); |  | 
|  528 } |  527 } | 
|  529  |  528  | 
|  530 void PrerenderContents::RenderProcessGone(base::TerminationStatus status) { |  529 void PrerenderContents::RenderProcessGone(base::TerminationStatus status) { | 
|  531   if (status == base::TERMINATION_STATUS_STILL_RUNNING) { |  530   if (status == base::TERMINATION_STATUS_STILL_RUNNING) { | 
|  532     // The renderer process is being killed because of the browser/test |  531     // The renderer process is being killed because of the browser/test | 
|  533     // shutdown, before the termination notification is received. |  532     // shutdown, before the termination notification is received. | 
|  534     Destroy(FINAL_STATUS_APP_TERMINATING); |  533     Destroy(FINAL_STATUS_APP_TERMINATING); | 
|  535   } |  534   } | 
|  536   Destroy(FINAL_STATUS_RENDERER_CRASHED); |  535   Destroy(FINAL_STATUS_RENDERER_CRASHED); | 
|  537 } |  536 } | 
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  794   idle_resources_.push_back(throttle); |  793   idle_resources_.push_back(throttle); | 
|  795 } |  794 } | 
|  796  |  795  | 
|  797 void PrerenderContents::AddNetworkBytes(int64_t bytes) { |  796 void PrerenderContents::AddNetworkBytes(int64_t bytes) { | 
|  798   network_bytes_ += bytes; |  797   network_bytes_ += bytes; | 
|  799   for (Observer& observer : observer_list_) |  798   for (Observer& observer : observer_list_) | 
|  800     observer.OnPrerenderNetworkBytesChanged(this); |  799     observer.OnPrerenderNetworkBytesChanged(this); | 
|  801 } |  800 } | 
|  802  |  801  | 
|  803 }  // namespace prerender |  802 }  // namespace prerender | 
| OLD | NEW |