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/browser/renderer_host/render_message_filter.h" | 5 #include "content/browser/renderer_host/render_message_filter.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 OnCacheableMetadataAvailable) | 373 OnCacheableMetadataAvailable) |
374 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_Keygen, OnKeygen) | 374 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_Keygen, OnKeygen) |
375 IPC_MESSAGE_HANDLER(ViewHostMsg_AsyncOpenFile, OnAsyncOpenFile) | 375 IPC_MESSAGE_HANDLER(ViewHostMsg_AsyncOpenFile, OnAsyncOpenFile) |
376 IPC_MESSAGE_HANDLER(ViewHostMsg_GetCPUUsage, OnGetCPUUsage) | 376 IPC_MESSAGE_HANDLER(ViewHostMsg_GetCPUUsage, OnGetCPUUsage) |
377 IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareBufferSize, | 377 IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareBufferSize, |
378 OnGetHardwareBufferSize) | 378 OnGetHardwareBufferSize) |
379 IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareInputSampleRate, | 379 IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareInputSampleRate, |
380 OnGetHardwareInputSampleRate) | 380 OnGetHardwareInputSampleRate) |
381 IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareSampleRate, | 381 IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareSampleRate, |
382 OnGetHardwareSampleRate) | 382 OnGetHardwareSampleRate) |
383 IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareInputChannelCount, | 383 IPC_MESSAGE_HANDLER(ViewHostMsg_GetHardwareInputChannelLayout, |
384 OnGetHardwareInputChannelCount) | 384 OnGetHardwareInputChannelLayout) |
385 IPC_MESSAGE_HANDLER(ViewHostMsg_MediaLogEvent, OnMediaLogEvent) | 385 IPC_MESSAGE_HANDLER(ViewHostMsg_MediaLogEvent, OnMediaLogEvent) |
386 IPC_MESSAGE_UNHANDLED(handled = false) | 386 IPC_MESSAGE_UNHANDLED(handled = false) |
387 IPC_END_MESSAGE_MAP_EX() | 387 IPC_END_MESSAGE_MAP_EX() |
388 | 388 |
389 return handled; | 389 return handled; |
390 } | 390 } |
391 | 391 |
392 void RenderMessageFilter::OnDestruct() const { | 392 void RenderMessageFilter::OnDestruct() const { |
393 BrowserThread::DeleteOnIOThread::Destruct(this); | 393 BrowserThread::DeleteOnIOThread::Destruct(this); |
394 } | 394 } |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 cpu_usage_sample_time_ = now; | 673 cpu_usage_sample_time_ = now; |
674 cpu_usage_ = static_cast<int>(process_metrics_->GetCPUUsage()); | 674 cpu_usage_ = static_cast<int>(process_metrics_->GetCPUUsage()); |
675 } | 675 } |
676 *cpu_usage = cpu_usage_; | 676 *cpu_usage = cpu_usage_; |
677 } | 677 } |
678 | 678 |
679 void RenderMessageFilter::OnGetHardwareBufferSize(uint32* buffer_size) { | 679 void RenderMessageFilter::OnGetHardwareBufferSize(uint32* buffer_size) { |
680 *buffer_size = static_cast<uint32>(media::GetAudioHardwareBufferSize()); | 680 *buffer_size = static_cast<uint32>(media::GetAudioHardwareBufferSize()); |
681 } | 681 } |
682 | 682 |
683 void RenderMessageFilter::OnGetHardwareInputSampleRate(double* sample_rate) { | 683 void RenderMessageFilter::OnGetHardwareInputSampleRate(int* sample_rate) { |
684 // TODO(henrika): add support for all available input devices. | 684 // TODO(henrika): add support for all available input devices. |
685 *sample_rate = media::GetAudioInputHardwareSampleRate( | 685 *sample_rate = media::GetAudioInputHardwareSampleRate( |
686 AudioManagerBase::kDefaultDeviceId); | 686 AudioManagerBase::kDefaultDeviceId); |
687 } | 687 } |
688 | 688 |
689 void RenderMessageFilter::OnGetHardwareSampleRate(double* sample_rate) { | 689 void RenderMessageFilter::OnGetHardwareSampleRate(int* sample_rate) { |
690 *sample_rate = media::GetAudioHardwareSampleRate(); | 690 *sample_rate = media::GetAudioHardwareSampleRate(); |
691 } | 691 } |
692 | 692 |
693 void RenderMessageFilter::OnGetHardwareInputChannelCount(uint32* channels) { | 693 void RenderMessageFilter::OnGetHardwareInputChannelLayout( |
| 694 ChannelLayout* layout) { |
694 // TODO(henrika): add support for all available input devices. | 695 // TODO(henrika): add support for all available input devices. |
695 *channels = static_cast<uint32>(media::GetAudioInputHardwareChannelCount( | 696 *layout = media::GetAudioInputHardwareChannelLayout( |
696 AudioManagerBase::kDefaultDeviceId)); | 697 AudioManagerBase::kDefaultDeviceId); |
697 } | 698 } |
698 | 699 |
699 void RenderMessageFilter::OnDownloadUrl(const IPC::Message& message, | 700 void RenderMessageFilter::OnDownloadUrl(const IPC::Message& message, |
700 const GURL& url, | 701 const GURL& url, |
701 const GURL& referrer, | 702 const GURL& referrer, |
702 const string16& suggested_name) { | 703 const string16& suggested_name) { |
703 content::DownloadSaveInfo save_info; | 704 content::DownloadSaveInfo save_info; |
704 save_info.suggested_name = suggested_name; | 705 save_info.suggested_name = suggested_name; |
705 scoped_ptr<net::URLRequest> request(new net::URLRequest(url, NULL)); | 706 scoped_ptr<net::URLRequest> request(new net::URLRequest(url, NULL)); |
706 request->set_referrer(referrer.spec()); | 707 request->set_referrer(referrer.spec()); |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 // for a resize or if no backing store) the RenderWidgetHost is blocking the | 937 // for a resize or if no backing store) the RenderWidgetHost is blocking the |
937 // UI thread for some time, waiting for an UpdateRect from the renderer. If we | 938 // UI thread for some time, waiting for an UpdateRect from the renderer. If we |
938 // are going to switch to accelerated compositing, the GPU process may need | 939 // are going to switch to accelerated compositing, the GPU process may need |
939 // round-trips to the UI thread before finishing the frame, causing deadlocks | 940 // round-trips to the UI thread before finishing the frame, causing deadlocks |
940 // if we delay the UpdateRect until we receive the OnSwapBuffersComplete. So | 941 // if we delay the UpdateRect until we receive the OnSwapBuffersComplete. So |
941 // the renderer sent us this message, so that we can unblock the UI thread. | 942 // the renderer sent us this message, so that we can unblock the UI thread. |
942 // We will simply re-use the UpdateRect unblock mechanism, just with a | 943 // We will simply re-use the UpdateRect unblock mechanism, just with a |
943 // different message. | 944 // different message. |
944 render_widget_helper_->DidReceiveUpdateMsg(msg); | 945 render_widget_helper_->DidReceiveUpdateMsg(msg); |
945 } | 946 } |
OLD | NEW |