Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(627)

Side by Side Diff: content/renderer/render_thread_impl.cc

Issue 114923005: base: Discardable memory types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review feedback Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 base::FilePath media_path; 404 base::FilePath media_path;
405 PathService::Get(DIR_MEDIA_LIBS, &media_path); 405 PathService::Get(DIR_MEDIA_LIBS, &media_path);
406 if (!media_path.empty()) 406 if (!media_path.empty())
407 media::InitializeMediaLibrary(media_path); 407 media::InitializeMediaLibrary(media_path);
408 408
409 memory_pressure_listener_.reset(new base::MemoryPressureListener( 409 memory_pressure_listener_.reset(new base::MemoryPressureListener(
410 base::Bind(&RenderThreadImpl::OnMemoryPressure, base::Unretained(this)))); 410 base::Bind(&RenderThreadImpl::OnMemoryPressure, base::Unretained(this))));
411 411
412 renderer_process_id_ = base::kNullProcessId; 412 renderer_process_id_ = base::kNullProcessId;
413 413
414 if (command_line.HasSwitch(switches::kUseDiscardableMemory)) {
415 std::string requested_type_name = command_line.GetSwitchValueASCII(
416 switches::kUseDiscardableMemory);
417 if (requested_type_name == "none") {
Philippe 2013/12/18 09:07:47 Nit: I would remove the braces for consistency wit
reveman 2013/12/18 19:44:25 I changed this a bit in latest patch by introducin
418 base::DiscardableMemory::SetType(base::DISCARDABLE_MEMORY_TYPE_NONE);
419 } else if (requested_type_name == "android") {
420 base::DiscardableMemory::SetType(base::DISCARDABLE_MEMORY_TYPE_ANDROID);
421 } else if (requested_type_name == "mac") {
422 base::DiscardableMemory::SetType(base::DISCARDABLE_MEMORY_TYPE_MAC);
423 } else if (requested_type_name == "emulated") {
424 base::DiscardableMemory::SetType(base::DISCARDABLE_MEMORY_TYPE_EMULATED);
425 }
426 }
427
414 // AllocateGpuMemoryBuffer must be used exclusively on one thread but 428 // AllocateGpuMemoryBuffer must be used exclusively on one thread but
415 // it doesn't have to be the same thread RenderThreadImpl is created on. 429 // it doesn't have to be the same thread RenderThreadImpl is created on.
416 allocate_gpu_memory_buffer_thread_checker_.DetachFromThread(); 430 allocate_gpu_memory_buffer_thread_checker_.DetachFromThread();
417 431
418 TRACE_EVENT_END_ETW("RenderThreadImpl::Init", 0, ""); 432 TRACE_EVENT_END_ETW("RenderThreadImpl::Init", 0, "");
419 } 433 }
420 434
421 RenderThreadImpl::~RenderThreadImpl() { 435 RenderThreadImpl::~RenderThreadImpl() {
422 } 436 }
423 437
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 if (!gamepad_shared_memory_reader_) 1373 if (!gamepad_shared_memory_reader_)
1360 gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader); 1374 gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader);
1361 gamepad_shared_memory_reader_->SampleGamepads(*data); 1375 gamepad_shared_memory_reader_->SampleGamepads(*data);
1362 } 1376 }
1363 1377
1364 base::ProcessId RenderThreadImpl::renderer_process_id() const { 1378 base::ProcessId RenderThreadImpl::renderer_process_id() const {
1365 return renderer_process_id_; 1379 return renderer_process_id_;
1366 } 1380 }
1367 1381
1368 } // namespace content 1382 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698