| 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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 supported_types.end(), | 423 supported_types.end(), |
| 424 requested_type) != supported_types.end()) { | 424 requested_type) != supported_types.end()) { |
| 425 type = requested_type; | 425 type = requested_type; |
| 426 } else { | 426 } else { |
| 427 LOG(ERROR) << "Requested discardable memory type is not supported."; | 427 LOG(ERROR) << "Requested discardable memory type is not supported."; |
| 428 } | 428 } |
| 429 } | 429 } |
| 430 | 430 |
| 431 base::DiscardableMemory::SetPreferredType(type); | 431 base::DiscardableMemory::SetPreferredType(type); |
| 432 | 432 |
| 433 // Allow discardable memory implementations to register memory pressure |
| 434 // listeners. |
| 435 base::DiscardableMemory::RegisterMemoryPressureListeners(); |
| 436 |
| 433 // AllocateGpuMemoryBuffer must be used exclusively on one thread but | 437 // AllocateGpuMemoryBuffer must be used exclusively on one thread but |
| 434 // it doesn't have to be the same thread RenderThreadImpl is created on. | 438 // it doesn't have to be the same thread RenderThreadImpl is created on. |
| 435 allocate_gpu_memory_buffer_thread_checker_.DetachFromThread(); | 439 allocate_gpu_memory_buffer_thread_checker_.DetachFromThread(); |
| 436 | 440 |
| 437 TRACE_EVENT_END_ETW("RenderThreadImpl::Init", 0, ""); | 441 TRACE_EVENT_END_ETW("RenderThreadImpl::Init", 0, ""); |
| 438 } | 442 } |
| 439 | 443 |
| 440 RenderThreadImpl::~RenderThreadImpl() { | 444 RenderThreadImpl::~RenderThreadImpl() { |
| 441 } | 445 } |
| 442 | 446 |
| (...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1396 hidden_widget_count_--; | 1400 hidden_widget_count_--; |
| 1397 | 1401 |
| 1398 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { | 1402 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { |
| 1399 return; | 1403 return; |
| 1400 } | 1404 } |
| 1401 | 1405 |
| 1402 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 1406 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
| 1403 } | 1407 } |
| 1404 | 1408 |
| 1405 } // namespace content | 1409 } // namespace content |
| OLD | NEW |