diff options
author | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-18 22:16:26 +0000 |
---|---|---|
committer | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-18 22:16:26 +0000 |
commit | faa2a45bf31af9e1131bb0cfa17ab1e2400ec0e4 (patch) | |
tree | f3f7c49fa06c0b32a78723f77bc3581559abb0f3 /ppapi/proxy/ppb_video_capture_proxy.cc | |
parent | de3c5ea947350a310bcdaabe7a8cb2dbef3fc9a8 (diff) | |
download | chromium_src-faa2a45bf31af9e1131bb0cfa17ab1e2400ec0e4.zip chromium_src-faa2a45bf31af9e1131bb0cfa17ab1e2400ec0e4.tar.gz chromium_src-faa2a45bf31af9e1131bb0cfa17ab1e2400ec0e4.tar.bz2 |
Revert 106142 - Add a new globals object for PPAPI tracking information.
This adds a specialization on the host and plugin side of the proxy. This
replaces the ad-hoc singleton tracking done by the resource and var trackers
with just being getters on this global object.
Most code can use the single PpapiGlobals class. I also allow code to get the
host and plugin specializations since some code needs access to some specific
features of each side.
In a later pass I'll move the other stuff out of TrackerBase and delete it.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/8316008
TBR=brettw@chromium.org
Review URL: http://codereview.chromium.org/8342016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106148 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/ppb_video_capture_proxy.cc')
-rw-r--r-- | ppapi/proxy/ppb_video_capture_proxy.cc | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/ppapi/proxy/ppb_video_capture_proxy.cc b/ppapi/proxy/ppb_video_capture_proxy.cc index c771bf5..9f40c1f 100644 --- a/ppapi/proxy/ppb_video_capture_proxy.cc +++ b/ppapi/proxy/ppb_video_capture_proxy.cc @@ -373,11 +373,11 @@ void PPP_VideoCapture_Proxy::OnMsgOnDeviceInfo( const PP_VideoCaptureDeviceInfo_Dev& info, const std::vector<PPPVideoCapture_Buffer>& buffers) { EnterPluginFromHostResource<PPB_VideoCapture_API> enter(host_resource); - if (enter.failed() || !ppp_video_capture_impl_) + PluginResourceTracker* tracker = PluginResourceTracker::GetInstance(); + PP_Resource resource = tracker->PluginResourceForHostResource(host_resource); + if (!resource || !ppp_video_capture_impl_ || enter.failed()) return; - PluginResourceTracker* tracker = - PluginGlobals::Get()->plugin_resource_tracker(); scoped_array<PP_Resource> resources(new PP_Resource[buffers.size()]); for (size_t i = 0; i < buffers.size(); ++i) { // We assume that the browser created a new set of resources. @@ -386,12 +386,10 @@ void PPP_VideoCapture_Proxy::OnMsgOnDeviceInfo( buffers[i].handle, buffers[i].size); } - - VideoCapture* capture = static_cast<VideoCapture*>(enter.object()); - capture->SetBufferCount(buffers.size()); + static_cast<VideoCapture*>(enter.object())->SetBufferCount(buffers.size()); ppp_video_capture_impl_->OnDeviceInfo( host_resource.instance(), - capture->pp_resource(), + resource, &info, buffers.size(), resources.get()); @@ -402,38 +400,40 @@ void PPP_VideoCapture_Proxy::OnMsgOnDeviceInfo( void PPP_VideoCapture_Proxy::OnMsgOnStatus(const HostResource& host_resource, uint32_t status) { EnterPluginFromHostResource<PPB_VideoCapture_API> enter(host_resource); - if (enter.failed() || !ppp_video_capture_impl_) + PluginResourceTracker* tracker = PluginResourceTracker::GetInstance(); + PP_Resource resource = tracker->PluginResourceForHostResource(host_resource); + if (!resource || !ppp_video_capture_impl_ || enter.failed()) return; - VideoCapture* capture = static_cast<VideoCapture*>(enter.object()); - if (!capture->OnStatus(status)) + if (!static_cast<VideoCapture*>(enter.object())->OnStatus(status)) return; ppp_video_capture_impl_->OnStatus( - host_resource.instance(), capture->pp_resource(), status); + host_resource.instance(), resource, status); } void PPP_VideoCapture_Proxy::OnMsgOnError(const HostResource& host_resource, uint32_t error_code) { EnterPluginFromHostResource<PPB_VideoCapture_API> enter(host_resource); - if (enter.failed() || !ppp_video_capture_impl_) + PluginResourceTracker* tracker = PluginResourceTracker::GetInstance(); + PP_Resource resource = tracker->PluginResourceForHostResource(host_resource); + if (!resource || !ppp_video_capture_impl_ || enter.failed()) return; - - VideoCapture* capture = static_cast<VideoCapture*>(enter.object()); - capture->set_status(PP_VIDEO_CAPTURE_STATUS_STOPPED); + static_cast<VideoCapture*>(enter.object())->set_status( + PP_VIDEO_CAPTURE_STATUS_STOPPED); ppp_video_capture_impl_->OnError( - host_resource.instance(), capture->pp_resource(), error_code); + host_resource.instance(), resource, error_code); } void PPP_VideoCapture_Proxy::OnMsgOnBufferReady( const HostResource& host_resource, uint32_t buffer) { EnterPluginFromHostResource<PPB_VideoCapture_API> enter(host_resource); - if (enter.failed() || !ppp_video_capture_impl_) + PluginResourceTracker* tracker = PluginResourceTracker::GetInstance(); + PP_Resource resource = tracker->PluginResourceForHostResource(host_resource); + if (!resource || !ppp_video_capture_impl_ || enter.failed()) return; - - VideoCapture* capture = static_cast<VideoCapture*>(enter.object()); - capture->SetBufferInUse(buffer); + static_cast<VideoCapture*>(enter.object())->SetBufferInUse(buffer); ppp_video_capture_impl_->OnBufferReady( - host_resource.instance(), capture->pp_resource(), buffer); + host_resource.instance(), resource, buffer); } } // namespace proxy |