| 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 base::FilePath media_path; | 399 base::FilePath media_path; |
| 400 PathService::Get(DIR_MEDIA_LIBS, &media_path); | 400 PathService::Get(DIR_MEDIA_LIBS, &media_path); |
| 401 if (!media_path.empty()) | 401 if (!media_path.empty()) |
| 402 media::InitializeMediaLibrary(media_path); | 402 media::InitializeMediaLibrary(media_path); |
| 403 | 403 |
| 404 memory_pressure_listener_.reset(new base::MemoryPressureListener( | 404 memory_pressure_listener_.reset(new base::MemoryPressureListener( |
| 405 base::Bind(&RenderThreadImpl::OnMemoryPressure, base::Unretained(this)))); | 405 base::Bind(&RenderThreadImpl::OnMemoryPressure, base::Unretained(this)))); |
| 406 | 406 |
| 407 renderer_process_id_ = base::kNullProcessId; | 407 renderer_process_id_ = base::kNullProcessId; |
| 408 | 408 |
| 409 if (command_line.HasSwitch(switches::kUseDiscardableMemory)) { |
| 410 std::string requested_type_name = command_line.GetSwitchValueASCII( |
| 411 switches::kUseDiscardableMemory); |
| 412 if (requested_type_name == "none") { |
| 413 base::DiscardableMemory::SetType(DISCARDABLE_MEMORY_NONE); |
| 414 } else if (requested_type_name == "android") { |
| 415 base::DiscardableMemory::SetType(DISCARDABLE_MEMORY_ANDROID); |
| 416 } else if (requested_type_name == "mac") { |
| 417 base::DiscardableMemory::SetType(DISCARDABLE_MEMORY_MAC); |
| 418 } else if (requested_type_name == "emulated") { |
| 419 base::DiscardableMemory::SetType(DISCARDABLE_MEMORY_EMULATED); |
| 420 } |
| 421 } |
| 422 |
| 409 // AllocateGpuMemoryBuffer must be used exclusively on one thread but | 423 // AllocateGpuMemoryBuffer must be used exclusively on one thread but |
| 410 // it doesn't have to be the same thread RenderThreadImpl is created on. | 424 // it doesn't have to be the same thread RenderThreadImpl is created on. |
| 411 allocate_gpu_memory_buffer_thread_checker_.DetachFromThread(); | 425 allocate_gpu_memory_buffer_thread_checker_.DetachFromThread(); |
| 412 | 426 |
| 413 TRACE_EVENT_END_ETW("RenderThreadImpl::Init", 0, ""); | 427 TRACE_EVENT_END_ETW("RenderThreadImpl::Init", 0, ""); |
| 414 } | 428 } |
| 415 | 429 |
| 416 RenderThreadImpl::~RenderThreadImpl() { | 430 RenderThreadImpl::~RenderThreadImpl() { |
| 417 } | 431 } |
| 418 | 432 |
| (...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1369 if (!gamepad_shared_memory_reader_) | 1383 if (!gamepad_shared_memory_reader_) |
| 1370 gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader); | 1384 gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader); |
| 1371 gamepad_shared_memory_reader_->SampleGamepads(*data); | 1385 gamepad_shared_memory_reader_->SampleGamepads(*data); |
| 1372 } | 1386 } |
| 1373 | 1387 |
| 1374 base::ProcessId RenderThreadImpl::renderer_process_id() const { | 1388 base::ProcessId RenderThreadImpl::renderer_process_id() const { |
| 1375 return renderer_process_id_; | 1389 return renderer_process_id_; |
| 1376 } | 1390 } |
| 1377 | 1391 |
| 1378 } // namespace content | 1392 } // namespace content |
| OLD | NEW |