| 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> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "base/metrics/stats_table.h" | 21 #include "base/metrics/stats_table.h" |
| 22 #include "base/path_service.h" | 22 #include "base/path_service.h" |
| 23 #include "base/strings/string16.h" | 23 #include "base/strings/string16.h" |
| 24 #include "base/strings/string_tokenizer.h" | 24 #include "base/strings/string_tokenizer.h" |
| 25 #include "base/strings/string_number_conversions.h" | 25 #include "base/strings/string_number_conversions.h" |
| 26 #include "base/strings/utf_string_conversions.h" | 26 #include "base/strings/utf_string_conversions.h" |
| 27 #include "base/threading/thread_local.h" | 27 #include "base/threading/thread_local.h" |
| 28 #include "base/threading/thread_restrictions.h" | 28 #include "base/threading/thread_restrictions.h" |
| 29 #include "base/values.h" | 29 #include "base/values.h" |
| 30 #include "cc/base/switches.h" | 30 #include "cc/base/switches.h" |
| 31 #include "cc/resources/raster_worker_pool.h" | 31 #include "cc/resources/worker_pool.h" |
| 32 #include "content/child/appcache/appcache_dispatcher.h" | 32 #include "content/child/appcache/appcache_dispatcher.h" |
| 33 #include "content/child/appcache/appcache_frontend_impl.h" | 33 #include "content/child/appcache/appcache_frontend_impl.h" |
| 34 #include "content/child/child_histogram_message_filter.h" | 34 #include "content/child/child_histogram_message_filter.h" |
| 35 #include "content/child/db_message_filter.h" | 35 #include "content/child/db_message_filter.h" |
| 36 #include "content/child/indexed_db/indexed_db_dispatcher.h" | 36 #include "content/child/indexed_db/indexed_db_dispatcher.h" |
| 37 #include "content/child/indexed_db/indexed_db_message_filter.h" | 37 #include "content/child/indexed_db/indexed_db_message_filter.h" |
| 38 #include "content/child/npapi/npobject_util.h" | 38 #include "content/child/npapi/npobject_util.h" |
| 39 #include "content/child/plugin_messages.h" | 39 #include "content/child/plugin_messages.h" |
| 40 #include "content/child/resource_dispatcher.h" | 40 #include "content/child/resource_dispatcher.h" |
| 41 #include "content/child/runtime_features.h" | 41 #include "content/child/runtime_features.h" |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 base::DiscardableMemory::SetPreferredType(type); | 436 base::DiscardableMemory::SetPreferredType(type); |
| 437 | 437 |
| 438 // Allow discardable memory implementations to register memory pressure | 438 // Allow discardable memory implementations to register memory pressure |
| 439 // listeners. | 439 // listeners. |
| 440 base::DiscardableMemory::RegisterMemoryPressureListeners(); | 440 base::DiscardableMemory::RegisterMemoryPressureListeners(); |
| 441 | 441 |
| 442 // AllocateGpuMemoryBuffer must be used exclusively on one thread but | 442 // AllocateGpuMemoryBuffer must be used exclusively on one thread but |
| 443 // it doesn't have to be the same thread RenderThreadImpl is created on. | 443 // it doesn't have to be the same thread RenderThreadImpl is created on. |
| 444 allocate_gpu_memory_buffer_thread_checker_.DetachFromThread(); | 444 allocate_gpu_memory_buffer_thread_checker_.DetachFromThread(); |
| 445 | 445 |
| 446 if (command_line.HasSwitch(switches::kNumRasterThreads)) { | 446 if (command_line.HasSwitch(cc::switches::kNumRasterThreads)) { |
| 447 int num_raster_threads; | 447 int num_raster_threads; |
| 448 std::string string_value = | 448 std::string string_value = |
| 449 command_line.GetSwitchValueASCII(switches::kNumRasterThreads); | 449 command_line.GetSwitchValueASCII(cc::switches::kNumRasterThreads); |
| 450 if (base::StringToInt(string_value, &num_raster_threads) && | 450 if (base::StringToInt(string_value, &num_raster_threads) && |
| 451 num_raster_threads >= kMinRasterThreads && | 451 num_raster_threads >= kMinRasterThreads && |
| 452 num_raster_threads <= kMaxRasterThreads) { | 452 num_raster_threads <= kMaxRasterThreads) { |
| 453 cc::RasterWorkerPool::SetNumRasterThreads(num_raster_threads); | 453 cc::WorkerPool::SetNumRasterThreads(num_raster_threads); |
| 454 } else { | 454 } else { |
| 455 LOG(WARNING) << "Failed to parse switch " << | 455 LOG(WARNING) << "Failed to parse switch " << |
| 456 switches::kNumRasterThreads << ": " << string_value; | 456 cc::switches::kNumRasterThreads << ": " << string_value; |
| 457 } | 457 } |
| 458 } | 458 } |
| 459 | 459 |
| 460 TRACE_EVENT_END_ETW("RenderThreadImpl::Init", 0, ""); | 460 TRACE_EVENT_END_ETW("RenderThreadImpl::Init", 0, ""); |
| 461 } | 461 } |
| 462 | 462 |
| 463 RenderThreadImpl::~RenderThreadImpl() { | 463 RenderThreadImpl::~RenderThreadImpl() { |
| 464 } | 464 } |
| 465 | 465 |
| 466 void RenderThreadImpl::Shutdown() { | 466 void RenderThreadImpl::Shutdown() { |
| (...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1432 hidden_widget_count_--; | 1432 hidden_widget_count_--; |
| 1433 | 1433 |
| 1434 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { | 1434 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { |
| 1435 return; | 1435 return; |
| 1436 } | 1436 } |
| 1437 | 1437 |
| 1438 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 1438 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
| 1439 } | 1439 } |
| 1440 | 1440 |
| 1441 } // namespace content | 1441 } // namespace content |
| OLD | NEW |