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 // AllocateGpuMemoryBuffer must be used exclusively on one thread but | |
410 // it doesn't have to be the same thread RenderThreadImpl is created on. | |
411 allocate_gpu_memory_buffer_thread_checker_.DetachFromThread(); | |
412 | |
413 TRACE_EVENT_END_ETW("RenderThreadImpl::Init", 0, ""); | 409 TRACE_EVENT_END_ETW("RenderThreadImpl::Init", 0, ""); |
414 } | 410 } |
415 | 411 |
416 RenderThreadImpl::~RenderThreadImpl() { | 412 RenderThreadImpl::~RenderThreadImpl() { |
417 } | 413 } |
418 | 414 |
419 void RenderThreadImpl::Shutdown() { | 415 void RenderThreadImpl::Shutdown() { |
420 FOR_EACH_OBSERVER( | 416 FOR_EACH_OBSERVER( |
421 RenderProcessObserver, observers_, OnRenderProcessShutdown()); | 417 RenderProcessObserver, observers_, OnRenderProcessShutdown()); |
422 | 418 |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 } | 1063 } |
1068 | 1064 |
1069 void RenderThreadImpl::DeleteImage(int32 image_id, int32 sync_point) { | 1065 void RenderThreadImpl::DeleteImage(int32 image_id, int32 sync_point) { |
1070 NOTREACHED(); | 1066 NOTREACHED(); |
1071 } | 1067 } |
1072 | 1068 |
1073 scoped_ptr<gfx::GpuMemoryBuffer> RenderThreadImpl::AllocateGpuMemoryBuffer( | 1069 scoped_ptr<gfx::GpuMemoryBuffer> RenderThreadImpl::AllocateGpuMemoryBuffer( |
1074 size_t width, | 1070 size_t width, |
1075 size_t height, | 1071 size_t height, |
1076 unsigned internalformat) { | 1072 unsigned internalformat) { |
1077 DCHECK(allocate_gpu_memory_buffer_thread_checker_.CalledOnValidThread()); | |
1078 | |
1079 if (!GpuMemoryBufferImpl::IsFormatValid(internalformat)) | 1073 if (!GpuMemoryBufferImpl::IsFormatValid(internalformat)) |
1080 return scoped_ptr<gfx::GpuMemoryBuffer>(); | 1074 return scoped_ptr<gfx::GpuMemoryBuffer>(); |
1081 | 1075 |
1082 gfx::GpuMemoryBufferHandle handle; | 1076 gfx::GpuMemoryBufferHandle handle; |
1083 bool success; | 1077 bool success; |
1084 IPC::Message* message = | 1078 IPC::Message* message = |
1085 new ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer(width, | 1079 new ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer(width, |
1086 height, | 1080 height, |
1087 internalformat, | 1081 internalformat, |
1088 &handle); | 1082 &handle); |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1365 if (!gamepad_shared_memory_reader_) | 1359 if (!gamepad_shared_memory_reader_) |
1366 gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader); | 1360 gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader); |
1367 gamepad_shared_memory_reader_->SampleGamepads(*data); | 1361 gamepad_shared_memory_reader_->SampleGamepads(*data); |
1368 } | 1362 } |
1369 | 1363 |
1370 base::ProcessId RenderThreadImpl::renderer_process_id() const { | 1364 base::ProcessId RenderThreadImpl::renderer_process_id() const { |
1371 return renderer_process_id_; | 1365 return renderer_process_id_; |
1372 } | 1366 } |
1373 | 1367 |
1374 } // namespace content | 1368 } // namespace content |
OLD | NEW |