| 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/worker_pool.h" | 31 #include "cc/resources/raster_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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 base::DiscardableMemory::SetPreferredType(type); | 435 base::DiscardableMemory::SetPreferredType(type); |
| 436 | 436 |
| 437 // Allow discardable memory implementations to register memory pressure | 437 // Allow discardable memory implementations to register memory pressure |
| 438 // listeners. | 438 // listeners. |
| 439 base::DiscardableMemory::RegisterMemoryPressureListeners(); | 439 base::DiscardableMemory::RegisterMemoryPressureListeners(); |
| 440 | 440 |
| 441 // AllocateGpuMemoryBuffer must be used exclusively on one thread but | 441 // AllocateGpuMemoryBuffer must be used exclusively on one thread but |
| 442 // it doesn't have to be the same thread RenderThreadImpl is created on. | 442 // it doesn't have to be the same thread RenderThreadImpl is created on. |
| 443 allocate_gpu_memory_buffer_thread_checker_.DetachFromThread(); | 443 allocate_gpu_memory_buffer_thread_checker_.DetachFromThread(); |
| 444 | 444 |
| 445 if (command_line.HasSwitch(cc::switches::kNumRasterThreads)) { | 445 if (command_line.HasSwitch(switches::kNumRasterThreads)) { |
| 446 int num_raster_threads; | 446 int num_raster_threads; |
| 447 std::string string_value = | 447 std::string string_value = |
| 448 command_line.GetSwitchValueASCII(cc::switches::kNumRasterThreads); | 448 command_line.GetSwitchValueASCII(switches::kNumRasterThreads); |
| 449 if (base::StringToInt(string_value, &num_raster_threads) && | 449 if (base::StringToInt(string_value, &num_raster_threads) && |
| 450 num_raster_threads >= kMinRasterThreads && | 450 num_raster_threads >= kMinRasterThreads && |
| 451 num_raster_threads <= kMaxRasterThreads) { | 451 num_raster_threads <= kMaxRasterThreads) { |
| 452 cc::WorkerPool::SetNumRasterThreads(num_raster_threads); | 452 cc::RasterWorkerPool::SetNumRasterThreads(num_raster_threads); |
| 453 } else { | 453 } else { |
| 454 LOG(WARNING) << "Failed to parse switch " << | 454 LOG(WARNING) << "Failed to parse switch " << |
| 455 cc::switches::kNumRasterThreads << ": " << string_value; | 455 switches::kNumRasterThreads << ": " << string_value; |
| 456 } | 456 } |
| 457 } | 457 } |
| 458 | 458 |
| 459 TRACE_EVENT_END_ETW("RenderThreadImpl::Init", 0, ""); | 459 TRACE_EVENT_END_ETW("RenderThreadImpl::Init", 0, ""); |
| 460 } | 460 } |
| 461 | 461 |
| 462 RenderThreadImpl::~RenderThreadImpl() { | 462 RenderThreadImpl::~RenderThreadImpl() { |
| 463 } | 463 } |
| 464 | 464 |
| 465 void RenderThreadImpl::Shutdown() { | 465 void RenderThreadImpl::Shutdown() { |
| (...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1419 hidden_widget_count_--; | 1419 hidden_widget_count_--; |
| 1420 | 1420 |
| 1421 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { | 1421 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { |
| 1422 return; | 1422 return; |
| 1423 } | 1423 } |
| 1424 | 1424 |
| 1425 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 1425 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
| 1426 } | 1426 } |
| 1427 | 1427 |
| 1428 } // namespace content | 1428 } // namespace content |
| OLD | NEW |