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

Side by Side Diff: content/renderer/pepper/pepper_plugin_delegate_impl.cc

Issue 14335017: content: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 months 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/pepper/pepper_plugin_delegate_impl.h" 5 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <cstddef> 8 #include <cstddef>
9 #include <map> 9 #include <map>
10 #include <queue> 10 #include <queue>
(...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1399 int request_id = 1399 int request_id =
1400 device_enumeration_event_handler_->RegisterEnumerateDevicesCallback( 1400 device_enumeration_event_handler_->RegisterEnumerateDevicesCallback(
1401 callback); 1401 callback);
1402 1402
1403 #if defined(ENABLE_WEBRTC) 1403 #if defined(ENABLE_WEBRTC)
1404 render_view_->media_stream_dispatcher()->EnumerateDevices( 1404 render_view_->media_stream_dispatcher()->EnumerateDevices(
1405 request_id, device_enumeration_event_handler_.get()->AsWeakPtr(), 1405 request_id, device_enumeration_event_handler_.get()->AsWeakPtr(),
1406 PepperDeviceEnumerationEventHandler::FromPepperDeviceType(type), 1406 PepperDeviceEnumerationEventHandler::FromPepperDeviceType(type),
1407 GURL()); 1407 GURL());
1408 #else 1408 #else
1409 MessageLoop::current()->PostTask( 1409 base::MessageLoop::current()->PostTask(
1410 FROM_HERE, 1410 FROM_HERE,
1411 base::Bind( 1411 base::Bind(
1412 &PepperDeviceEnumerationEventHandler::OnDevicesEnumerationFailed, 1412 &PepperDeviceEnumerationEventHandler::OnDevicesEnumerationFailed,
1413 device_enumeration_event_handler_->AsWeakPtr(), request_id)); 1413 device_enumeration_event_handler_->AsWeakPtr(),
1414 request_id));
1414 #endif 1415 #endif
1415 1416
1416 return request_id; 1417 return request_id;
1417 } 1418 }
1418 1419
1419 void PepperPluginDelegateImpl::StopEnumerateDevices(int request_id) { 1420 void PepperPluginDelegateImpl::StopEnumerateDevices(int request_id) {
1420 device_enumeration_event_handler_->UnregisterEnumerateDevicesCallback( 1421 device_enumeration_event_handler_->UnregisterEnumerateDevicesCallback(
1421 request_id); 1422 request_id);
1422 1423
1423 #if defined(ENABLE_WEBRTC) 1424 #if defined(ENABLE_WEBRTC)
1424 // Need to post task since this function might be called inside the callback 1425 // Need to post task since this function might be called inside the callback
1425 // of EnumerateDevices. 1426 // of EnumerateDevices.
1426 MessageLoop::current()->PostTask( 1427 base::MessageLoop::current()->PostTask(
1427 FROM_HERE, 1428 FROM_HERE,
1428 base::Bind( 1429 base::Bind(&MediaStreamDispatcher::StopEnumerateDevices,
1429 &MediaStreamDispatcher::StopEnumerateDevices, 1430 render_view_->media_stream_dispatcher()->AsWeakPtr(),
1430 render_view_->media_stream_dispatcher()->AsWeakPtr(), 1431 request_id,
1431 request_id, device_enumeration_event_handler_.get()->AsWeakPtr())); 1432 device_enumeration_event_handler_.get()->AsWeakPtr()));
1432 #endif 1433 #endif
1433 } 1434 }
1434 1435
1435 bool PepperPluginDelegateImpl::OnMessageReceived(const IPC::Message& message) { 1436 bool PepperPluginDelegateImpl::OnMessageReceived(const IPC::Message& message) {
1436 bool handled = true; 1437 bool handled = true;
1437 IPC_BEGIN_MESSAGE_MAP(PepperPluginDelegateImpl, message) 1438 IPC_BEGIN_MESSAGE_MAP(PepperPluginDelegateImpl, message)
1438 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ConnectACK, 1439 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_ConnectACK,
1439 OnTCPSocketConnectACK) 1440 OnTCPSocketConnectACK)
1440 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SSLHandshakeACK, 1441 IPC_MESSAGE_HANDLER(PpapiMsg_PPBTCPSocket_SSLHandshakeACK,
1441 OnTCPSocketSSLHandshakeACK) 1442 OnTCPSocketSSLHandshakeACK)
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 device_enumeration_event_handler_->RegisterOpenDeviceCallback(callback); 1564 device_enumeration_event_handler_->RegisterOpenDeviceCallback(callback);
1564 1565
1565 #if defined(ENABLE_WEBRTC) 1566 #if defined(ENABLE_WEBRTC)
1566 render_view_->media_stream_dispatcher()->OpenDevice( 1567 render_view_->media_stream_dispatcher()->OpenDevice(
1567 request_id, 1568 request_id,
1568 device_enumeration_event_handler_.get()->AsWeakPtr(), 1569 device_enumeration_event_handler_.get()->AsWeakPtr(),
1569 device_id, 1570 device_id,
1570 PepperDeviceEnumerationEventHandler::FromPepperDeviceType(type), 1571 PepperDeviceEnumerationEventHandler::FromPepperDeviceType(type),
1571 GURL()); 1572 GURL());
1572 #else 1573 #else
1573 MessageLoop::current()->PostTask( 1574 base::MessageLoop::current()->PostTask(
1574 FROM_HERE, 1575 FROM_HERE,
1575 base::Bind(&PepperDeviceEnumerationEventHandler::OnDeviceOpenFailed, 1576 base::Bind(&PepperDeviceEnumerationEventHandler::OnDeviceOpenFailed,
1576 device_enumeration_event_handler_->AsWeakPtr(), request_id)); 1577 device_enumeration_event_handler_->AsWeakPtr(),
1578 request_id));
1577 #endif 1579 #endif
1578 1580
1579 return request_id; 1581 return request_id;
1580 } 1582 }
1581 1583
1582 void PepperPluginDelegateImpl::CloseDevice(const std::string& label) { 1584 void PepperPluginDelegateImpl::CloseDevice(const std::string& label) {
1583 #if defined(ENABLE_WEBRTC) 1585 #if defined(ENABLE_WEBRTC)
1584 render_view_->media_stream_dispatcher()->CloseDevice(label); 1586 render_view_->media_stream_dispatcher()->CloseDevice(label);
1585 #endif 1587 #endif
1586 } 1588 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 should_close_source); 1650 should_close_source);
1649 } 1651 }
1650 1652
1651 bool PepperPluginDelegateImpl::IsRunningInProcess(PP_Instance instance) const { 1653 bool PepperPluginDelegateImpl::IsRunningInProcess(PP_Instance instance) const {
1652 RendererPpapiHostImpl* host = 1654 RendererPpapiHostImpl* host =
1653 RendererPpapiHostImpl::GetForPPInstance(instance); 1655 RendererPpapiHostImpl::GetForPPInstance(instance);
1654 return host && host->IsRunningInProcess(); 1656 return host && host->IsRunningInProcess();
1655 } 1657 }
1656 1658
1657 } // namespace content 1659 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_in_process_router.cc ('k') | content/renderer/render_thread_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698