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

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

Issue 8171015: Rename RenderThread to RenderThreadImpl (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_plugin_delegate_impl.h" 5 #include "content/renderer/pepper_plugin_delegate_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <queue> 8 #include <queue>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 21 matching lines...) Expand all
32 #include "content/public/renderer/content_renderer_client.h" 32 #include "content/public/renderer/content_renderer_client.h"
33 #include "content/renderer/gpu/command_buffer_proxy.h" 33 #include "content/renderer/gpu/command_buffer_proxy.h"
34 #include "content/renderer/gpu/gpu_channel_host.h" 34 #include "content/renderer/gpu/gpu_channel_host.h"
35 #include "content/renderer/gpu/renderer_gl_context.h" 35 #include "content/renderer/gpu/renderer_gl_context.h"
36 #include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h" 36 #include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h"
37 #include "content/renderer/media/audio_message_filter.h" 37 #include "content/renderer/media/audio_message_filter.h"
38 #include "content/renderer/media/video_capture_impl_manager.h" 38 #include "content/renderer/media/video_capture_impl_manager.h"
39 #include "content/renderer/p2p/p2p_transport_impl.h" 39 #include "content/renderer/p2p/p2p_transport_impl.h"
40 #include "content/renderer/pepper_platform_context_3d_impl.h" 40 #include "content/renderer/pepper_platform_context_3d_impl.h"
41 #include "content/renderer/pepper_platform_video_decoder_impl.h" 41 #include "content/renderer/pepper_platform_video_decoder_impl.h"
42 #include "content/renderer/render_thread.h" 42 #include "content/renderer/render_thread_impl.h"
43 #include "content/renderer/render_view.h" 43 #include "content/renderer/render_view.h"
44 #include "content/renderer/render_widget_fullscreen_pepper.h" 44 #include "content/renderer/render_widget_fullscreen_pepper.h"
45 #include "content/renderer/webplugin_delegate_proxy.h" 45 #include "content/renderer/webplugin_delegate_proxy.h"
46 #include "ipc/ipc_channel_handle.h" 46 #include "ipc/ipc_channel_handle.h"
47 #include "media/video/capture/video_capture_proxy.h" 47 #include "media/video/capture/video_capture_proxy.h"
48 #include "ppapi/c/dev/pp_video_dev.h" 48 #include "ppapi/c/dev/pp_video_dev.h"
49 #include "ppapi/c/pp_errors.h" 49 #include "ppapi/c/pp_errors.h"
50 #include "ppapi/c/private/ppb_flash.h" 50 #include "ppapi/c/private/ppb_flash.h"
51 #include "ppapi/c/private/ppb_flash_net_connector.h" 51 #include "ppapi/c/private/ppb_flash_net_connector.h"
52 #include "ppapi/proxy/host_dispatcher.h" 52 #include "ppapi/proxy/host_dispatcher.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 PlatformImage2DImpl(int width, int height, TransportDIB* dib) 121 PlatformImage2DImpl(int width, int height, TransportDIB* dib)
122 : width_(width), 122 : width_(width),
123 height_(height), 123 height_(height),
124 dib_(dib) { 124 dib_(dib) {
125 } 125 }
126 126
127 #if defined(OS_MACOSX) 127 #if defined(OS_MACOSX)
128 // On Mac, we have to tell the browser to free the transport DIB. 128 // On Mac, we have to tell the browser to free the transport DIB.
129 virtual ~PlatformImage2DImpl() { 129 virtual ~PlatformImage2DImpl() {
130 if (dib_.get()) { 130 if (dib_.get()) {
131 RenderThread::current()->Send( 131 RenderThreadImpl::current()->Send(
132 new ViewHostMsg_FreeTransportDIB(dib_->id())); 132 new ViewHostMsg_FreeTransportDIB(dib_->id()));
133 } 133 }
134 } 134 }
135 #endif 135 #endif
136 136
137 virtual skia::PlatformCanvas* Map() { 137 virtual skia::PlatformCanvas* Map() {
138 return dib_->GetPlatformCanvas(width_, height_); 138 return dib_->GetPlatformCanvas(width_, height_);
139 } 139 }
140 140
141 virtual intptr_t GetSharedMemoryHandle(uint32* byte_count) const { 141 virtual intptr_t GetSharedMemoryHandle(uint32* byte_count) const {
(...skipping 21 matching lines...) Expand all
163 163
164 164
165 class PlatformAudioImpl 165 class PlatformAudioImpl
166 : public webkit::ppapi::PluginDelegate::PlatformAudio, 166 : public webkit::ppapi::PluginDelegate::PlatformAudio,
167 public AudioMessageFilter::Delegate, 167 public AudioMessageFilter::Delegate,
168 public base::RefCountedThreadSafe<PlatformAudioImpl> { 168 public base::RefCountedThreadSafe<PlatformAudioImpl> {
169 public: 169 public:
170 PlatformAudioImpl() 170 PlatformAudioImpl()
171 : client_(NULL), stream_id_(0), 171 : client_(NULL), stream_id_(0),
172 main_message_loop_(MessageLoop::current()) { 172 main_message_loop_(MessageLoop::current()) {
173 filter_ = RenderThread::current()->audio_message_filter(); 173 filter_ = RenderThreadImpl::current()->audio_message_filter();
174 } 174 }
175 175
176 virtual ~PlatformAudioImpl() { 176 virtual ~PlatformAudioImpl() {
177 // Make sure we have been shut down. Warning: this will usually happen on 177 // Make sure we have been shut down. Warning: this will usually happen on
178 // the I/O thread! 178 // the I/O thread!
179 DCHECK_EQ(0, stream_id_); 179 DCHECK_EQ(0, stream_id_);
180 DCHECK(!client_); 180 DCHECK(!client_);
181 } 181 }
182 182
183 // Initialize this audio context. StreamCreated() will be called when the 183 // Initialize this audio context. StreamCreated() will be called when the
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 scoped_ptr<PluginCallback> callback_; 410 scoped_ptr<PluginCallback> callback_;
411 }; 411 };
412 412
413 class PlatformVideoCaptureImpl 413 class PlatformVideoCaptureImpl
414 : public webkit::ppapi::PluginDelegate::PlatformVideoCapture { 414 : public webkit::ppapi::PluginDelegate::PlatformVideoCapture {
415 public: 415 public:
416 PlatformVideoCaptureImpl(media::VideoCapture::EventHandler* handler) 416 PlatformVideoCaptureImpl(media::VideoCapture::EventHandler* handler)
417 : handler_proxy_(new media::VideoCaptureHandlerProxy( 417 : handler_proxy_(new media::VideoCaptureHandlerProxy(
418 handler, base::MessageLoopProxy::current())) { 418 handler, base::MessageLoopProxy::current())) {
419 VideoCaptureImplManager* manager = 419 VideoCaptureImplManager* manager =
420 RenderThread::current()->video_capture_impl_manager(); 420 RenderThreadImpl::current()->video_capture_impl_manager();
421 // 1 means the "default" video capture device. 421 // 1 means the "default" video capture device.
422 // TODO(piman): Add a way to enumerate devices and pass them through the 422 // TODO(piman): Add a way to enumerate devices and pass them through the
423 // API. 423 // API.
424 video_capture_ = manager->AddDevice(1, handler_proxy_.get()); 424 video_capture_ = manager->AddDevice(1, handler_proxy_.get());
425 } 425 }
426 426
427 // Overrides from media::VideoCapture::EventHandler 427 // Overrides from media::VideoCapture::EventHandler
428 virtual ~PlatformVideoCaptureImpl() { 428 virtual ~PlatformVideoCaptureImpl() {
429 VideoCaptureImplManager* manager = 429 VideoCaptureImplManager* manager =
430 RenderThread::current()->video_capture_impl_manager(); 430 RenderThreadImpl::current()->video_capture_impl_manager();
431 manager->RemoveDevice(1, handler_proxy_.get()); 431 manager->RemoveDevice(1, handler_proxy_.get());
432 } 432 }
433 433
434 virtual void StartCapture( 434 virtual void StartCapture(
435 EventHandler* handler, 435 EventHandler* handler,
436 const VideoCaptureCapability& capability) OVERRIDE { 436 const VideoCaptureCapability& capability) OVERRIDE {
437 DCHECK(handler == handler_proxy_->proxied()); 437 DCHECK(handler == handler_proxy_->proxied());
438 video_capture_->StartCapture(handler_proxy_.get(), capability); 438 video_capture_->StartCapture(handler_proxy_.get(), capability);
439 } 439 }
440 440
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 // work in the sandbox. Do this by sending a message to the browser 899 // work in the sandbox. Do this by sending a message to the browser
900 // requesting a TransportDIB (see also 900 // requesting a TransportDIB (see also
901 // chrome/renderer/webplugin_delegate_proxy.cc, method 901 // chrome/renderer/webplugin_delegate_proxy.cc, method
902 // WebPluginDelegateProxy::CreateBitmap() for similar code). The TransportDIB 902 // WebPluginDelegateProxy::CreateBitmap() for similar code). The TransportDIB
903 // is cached in the browser, and is freed (in typical cases) by the 903 // is cached in the browser, and is freed (in typical cases) by the
904 // PlatformImage2DImpl's destructor. 904 // PlatformImage2DImpl's destructor.
905 TransportDIB::Handle dib_handle; 905 TransportDIB::Handle dib_handle;
906 IPC::Message* msg = new ViewHostMsg_AllocTransportDIB(buffer_size, 906 IPC::Message* msg = new ViewHostMsg_AllocTransportDIB(buffer_size,
907 true, 907 true,
908 &dib_handle); 908 &dib_handle);
909 if (!RenderThread::current()->Send(msg)) 909 if (!RenderThreadImpl::current()->Send(msg))
910 return NULL; 910 return NULL;
911 if (!TransportDIB::is_valid_handle(dib_handle)) 911 if (!TransportDIB::is_valid_handle(dib_handle))
912 return NULL; 912 return NULL;
913 913
914 TransportDIB* dib = TransportDIB::Map(dib_handle); 914 TransportDIB* dib = TransportDIB::Map(dib_handle);
915 #else 915 #else
916 static int next_dib_id = 0; 916 static int next_dib_id = 0;
917 TransportDIB* dib = TransportDIB::Create(buffer_size, next_dib_id++); 917 TransportDIB* dib = TransportDIB::Create(buffer_size, next_dib_id++);
918 if (!dib) 918 if (!dib)
919 return NULL; 919 return NULL;
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 virtual void DidWrite(int64 bytes, bool complete) { 1236 virtual void DidWrite(int64 bytes, bool complete) {
1237 NOTREACHED(); 1237 NOTREACHED();
1238 } 1238 }
1239 1239
1240 virtual void DidOpenFile( 1240 virtual void DidOpenFile(
1241 base::PlatformFile file, 1241 base::PlatformFile file,
1242 base::ProcessHandle unused) { 1242 base::ProcessHandle unused) {
1243 callback_->Run(base::PLATFORM_FILE_OK, base::PassPlatformFile(&file)); 1243 callback_->Run(base::PLATFORM_FILE_OK, base::PassPlatformFile(&file));
1244 // Make sure we won't leak file handle if the requester has died. 1244 // Make sure we won't leak file handle if the requester has died.
1245 if (file != base::kInvalidPlatformFileValue) { 1245 if (file != base::kInvalidPlatformFileValue) {
1246 base::FileUtilProxy::Close( 1246 base::FileUtilProxy::Close(RenderThreadImpl::current()->
1247 RenderThread::current()->GetFileThreadMessageLoopProxy(), file, NULL); 1247 GetFileThreadMessageLoopProxy(), file, NULL);
1248 } 1248 }
1249 } 1249 }
1250 1250
1251 private: // TODO(ericu): Delete this? 1251 private: // TODO(ericu): Delete this?
1252 webkit::ppapi::PluginDelegate::AsyncOpenFileCallback* callback_; 1252 webkit::ppapi::PluginDelegate::AsyncOpenFileCallback* callback_;
1253 }; 1253 };
1254 1254
1255 bool PepperPluginDelegateImpl::AsyncOpenFileSystemURL( 1255 bool PepperPluginDelegateImpl::AsyncOpenFileSystemURL(
1256 const GURL& path, int flags, AsyncOpenFileCallback* callback) { 1256 const GURL& path, int flags, AsyncOpenFileCallback* callback) {
1257 1257
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 webkit::ppapi::DirContents* contents) { 1322 webkit::ppapi::DirContents* contents) {
1323 base::PlatformFileError error; 1323 base::PlatformFileError error;
1324 IPC::Message* msg = new PepperFileMsg_GetDirContents(path, contents, &error); 1324 IPC::Message* msg = new PepperFileMsg_GetDirContents(path, contents, &error);
1325 if (!render_view_->Send(msg)) 1325 if (!render_view_->Send(msg))
1326 return base::PLATFORM_FILE_ERROR_FAILED; 1326 return base::PLATFORM_FILE_ERROR_FAILED;
1327 return error; 1327 return error;
1328 } 1328 }
1329 1329
1330 void PepperPluginDelegateImpl::SyncGetFileSystemPlatformPath( 1330 void PepperPluginDelegateImpl::SyncGetFileSystemPlatformPath(
1331 const GURL& url, FilePath* platform_path) { 1331 const GURL& url, FilePath* platform_path) {
1332 RenderThread::current()->Send(new FileSystemHostMsg_SyncGetPlatformPath( 1332 RenderThreadImpl::current()->Send(new FileSystemHostMsg_SyncGetPlatformPath(
1333 url, platform_path)); 1333 url, platform_path));
1334 } 1334 }
1335 1335
1336 scoped_refptr<base::MessageLoopProxy> 1336 scoped_refptr<base::MessageLoopProxy>
1337 PepperPluginDelegateImpl::GetFileThreadMessageLoopProxy() { 1337 PepperPluginDelegateImpl::GetFileThreadMessageLoopProxy() {
1338 return RenderThread::current()->GetFileThreadMessageLoopProxy(); 1338 return RenderThreadImpl::current()->GetFileThreadMessageLoopProxy();
1339 } 1339 }
1340 1340
1341 int32_t PepperPluginDelegateImpl::ConnectTcp( 1341 int32_t PepperPluginDelegateImpl::ConnectTcp(
1342 webkit::ppapi::PPB_Flash_NetConnector_Impl* connector, 1342 webkit::ppapi::PPB_Flash_NetConnector_Impl* connector,
1343 const char* host, 1343 const char* host,
1344 uint16_t port) { 1344 uint16_t port) {
1345 int request_id = pending_connect_tcps_.Add( 1345 int request_id = pending_connect_tcps_.Add(
1346 new scoped_refptr<webkit::ppapi::PPB_Flash_NetConnector_Impl>(connector)); 1346 new scoped_refptr<webkit::ppapi::PPB_Flash_NetConnector_Impl>(connector));
1347 IPC::Message* msg = 1347 IPC::Message* msg =
1348 new PepperMsg_ConnectTcp(render_view_->routing_id(), 1348 new PepperMsg_ConnectTcp(render_view_->routing_id(),
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 subscribed_to_policy_updates_.insert(instance); 1491 subscribed_to_policy_updates_.insert(instance);
1492 1492
1493 // TODO(ajwong): Make this only send an update to the current instance, 1493 // TODO(ajwong): Make this only send an update to the current instance,
1494 // and not all subscribed plugin instances. 1494 // and not all subscribed plugin instances.
1495 render_view_->RequestRemoteAccessClientFirewallTraversal(); 1495 render_view_->RequestRemoteAccessClientFirewallTraversal();
1496 } 1496 }
1497 1497
1498 std::string PepperPluginDelegateImpl::ResolveProxy(const GURL& url) { 1498 std::string PepperPluginDelegateImpl::ResolveProxy(const GURL& url) {
1499 bool result; 1499 bool result;
1500 std::string proxy_result; 1500 std::string proxy_result;
1501 RenderThread::current()->Send( 1501 RenderThreadImpl::current()->Send(
1502 new ViewHostMsg_ResolveProxy(url, &result, &proxy_result)); 1502 new ViewHostMsg_ResolveProxy(url, &result, &proxy_result));
1503 return proxy_result; 1503 return proxy_result;
1504 } 1504 }
1505 1505
1506 void PepperPluginDelegateImpl::DidStartLoading() { 1506 void PepperPluginDelegateImpl::DidStartLoading() {
1507 render_view_->DidStartLoadingForPlugin(); 1507 render_view_->DidStartLoadingForPlugin();
1508 } 1508 }
1509 1509
1510 void PepperPluginDelegateImpl::DidStopLoading() { 1510 void PepperPluginDelegateImpl::DidStopLoading() {
1511 render_view_->DidStopLoadingForPlugin(); 1511 render_view_->DidStopLoadingForPlugin();
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 1616
1617 int PepperPluginDelegateImpl::GetRoutingId() const { 1617 int PepperPluginDelegateImpl::GetRoutingId() const {
1618 return render_view_->routing_id(); 1618 return render_view_->routing_id();
1619 } 1619 }
1620 1620
1621 void PepperPluginDelegateImpl::PublishInitialPolicy( 1621 void PepperPluginDelegateImpl::PublishInitialPolicy(
1622 scoped_refptr<webkit::ppapi::PluginInstance> instance, 1622 scoped_refptr<webkit::ppapi::PluginInstance> instance,
1623 const std::string& policy) { 1623 const std::string& policy) {
1624 instance->HandlePolicyUpdate(policy); 1624 instance->HandlePolicyUpdate(policy);
1625 } 1625 }
OLDNEW
« no previous file with comments | « content/renderer/pepper_platform_video_decoder_impl.cc ('k') | content/renderer/render_process_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698