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 "content/renderer/render_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/allocator/allocator_extension.h" | 12 #include "base/allocator/allocator_extension.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
15 #include "base/location.h" | 15 #include "base/location.h" |
16 #include "base/logging.h" | 16 #include "base/logging.h" |
17 #include "base/memory/discardable_memory_allocator.h" | 17 #include "base/memory/discardable_memory_allocator.h" |
18 #include "base/memory/shared_memory.h" | 18 #include "base/memory/shared_memory.h" |
19 #include "base/metrics/field_trial.h" | 19 #include "base/metrics/field_trial.h" |
20 #include "base/metrics/histogram.h" | 20 #include "base/metrics/histogram.h" |
21 #include "base/path_service.h" | 21 #include "base/path_service.h" |
22 #include "base/single_thread_task_runner.h" | 22 #include "base/single_thread_task_runner.h" |
23 #include "base/strings/string16.h" | 23 #include "base/strings/string16.h" |
24 #include "base/strings/string_number_conversions.h" | 24 #include "base/strings/string_number_conversions.h" |
25 #include "base/strings/string_split.h" | |
25 #include "base/strings/string_tokenizer.h" | 26 #include "base/strings/string_tokenizer.h" |
26 #include "base/strings/sys_string_conversions.h" | 27 #include "base/strings/sys_string_conversions.h" |
27 #include "base/strings/utf_string_conversions.h" | 28 #include "base/strings/utf_string_conversions.h" |
28 #include "base/thread_task_runner_handle.h" | 29 #include "base/thread_task_runner_handle.h" |
29 #include "base/threading/simple_thread.h" | 30 #include "base/threading/simple_thread.h" |
30 #include "base/threading/thread_local.h" | 31 #include "base/threading/thread_local.h" |
31 #include "base/threading/thread_restrictions.h" | 32 #include "base/threading/thread_restrictions.h" |
32 #include "base/trace_event/memory_dump_manager.h" | 33 #include "base/trace_event/memory_dump_manager.h" |
33 #include "base/trace_event/trace_event.h" | 34 #include "base/trace_event/trace_event.h" |
34 #include "base/values.h" | 35 #include "base/values.h" |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
281 if (host == "mail.google.com") | 282 if (host == "mail.google.com") |
282 return ".gmail"; | 283 return ".gmail"; |
283 if (host == "docs.google.com" || host == "drive.google.com") | 284 if (host == "docs.google.com" || host == "drive.google.com") |
284 return ".docs"; | 285 return ".docs"; |
285 if (host == "plus.google.com") | 286 if (host == "plus.google.com") |
286 return ".plus"; | 287 return ".plus"; |
287 if (host == "inbox.google.com") | 288 if (host == "inbox.google.com") |
288 return ".inbox"; | 289 return ".inbox"; |
289 if (host == "www.youtube.com") | 290 if (host == "www.youtube.com") |
290 return ".youtube"; | 291 return ".youtube"; |
292 | |
293 // The Top10 sites have different TLD and/or subdomains | |
294 // depending on the localization | |
295 if (host == "sina.com.cn") | |
296 return ".top10"; | |
297 | |
298 std::vector<base::StringPiece> host_tokens = base::SplitStringPiece( | |
299 host, ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); | |
300 | |
301 if (host_tokens.size() == 3) { | |
302 if ((host_tokens[1] == "facebook") || | |
303 (host_tokens[1] == "baidu") || | |
304 (host_tokens[1] == "yahoo") || | |
305 (host_tokens[1] == "amazon") || | |
306 (host_tokens[1] == "qq") || | |
307 (host_tokens[1] == "twitter") || | |
308 (host_tokens[1] == "taobao") || | |
309 (host_tokens[1] == "live") || | |
310 (host_tokens[1] == "linkedin")) | |
jochen (gone - plz use gerrit)
2015/10/21 13:17:57
according to http://www.alexa.com/topsites linkedi
Michael Hablich
2015/10/22 13:16:35
You are right: Removed linkedin, added wikipedia
| |
311 return ".top10"; | |
312 } | |
313 | |
291 return std::string(); | 314 return std::string(); |
292 } | 315 } |
293 | 316 |
294 void* CreateHistogram( | 317 void* CreateHistogram( |
295 const char *name, int min, int max, size_t buckets) { | 318 const char *name, int min, int max, size_t buckets) { |
296 if (min <= 0) | 319 if (min <= 0) |
297 min = 1; | 320 min = 1; |
298 std::string histogram_name; | 321 std::string histogram_name; |
299 RenderThreadImpl* render_thread_impl = RenderThreadImpl::current(); | 322 RenderThreadImpl* render_thread_impl = RenderThreadImpl::current(); |
300 if (render_thread_impl) { // Can be null in tests. | 323 if (render_thread_impl) { // Can be null in tests. |
(...skipping 1667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1968 } | 1991 } |
1969 | 1992 |
1970 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { | 1993 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { |
1971 size_t erased = | 1994 size_t erased = |
1972 RenderThreadImpl::current()->pending_render_frame_connects_.erase( | 1995 RenderThreadImpl::current()->pending_render_frame_connects_.erase( |
1973 routing_id_); | 1996 routing_id_); |
1974 DCHECK_EQ(1u, erased); | 1997 DCHECK_EQ(1u, erased); |
1975 } | 1998 } |
1976 | 1999 |
1977 } // namespace content | 2000 } // namespace content |
OLD | NEW |