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

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

Issue 3915002: Out of process Pepper (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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
« no previous file with comments | « chrome/renderer/pepper_plugin_delegate_impl.h ('k') | chrome/renderer/render_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <cmath> 5 #include <cmath>
6 6
7 #include "chrome/renderer/pepper_plugin_delegate_impl.h" 7 #include "chrome/renderer/pepper_plugin_delegate_impl.h"
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/surface/transport_dib.h" 10 #include "app/surface/transport_dib.h"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/scoped_ptr.h" 13 #include "base/scoped_ptr.h"
14 #include "base/string_split.h" 14 #include "base/string_split.h"
15 #include "base/task.h" 15 #include "base/task.h"
16 #include "base/time.h" 16 #include "base/time.h"
17 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
18 #include "chrome/common/child_thread.h" 18 #include "chrome/common/child_thread.h"
19 #include "chrome/common/file_system/file_system_dispatcher.h" 19 #include "chrome/common/file_system/file_system_dispatcher.h"
20 #include "chrome/common/render_messages.h" 20 #include "chrome/common/render_messages.h"
21 #include "chrome/common/render_messages_params.h" 21 #include "chrome/common/render_messages_params.h"
22 #include "chrome/renderer/audio_message_filter.h" 22 #include "chrome/renderer/audio_message_filter.h"
23 #include "chrome/renderer/command_buffer_proxy.h" 23 #include "chrome/renderer/command_buffer_proxy.h"
24 #include "chrome/renderer/render_thread.h" 24 #include "chrome/renderer/render_thread.h"
25 #include "chrome/renderer/render_view.h" 25 #include "chrome/renderer/render_view.h"
26 #include "chrome/renderer/webplugin_delegate_proxy.h" 26 #include "chrome/renderer/webplugin_delegate_proxy.h"
27 #include "grit/locale_settings.h" 27 #include "grit/locale_settings.h"
28 #include "ipc/ipc_channel_handle.h"
28 #include "ppapi/c/dev/pp_video_dev.h" 29 #include "ppapi/c/dev/pp_video_dev.h"
29 #include "third_party/WebKit/WebKit/chromium/public/WebFileChooserCompletion.h" 30 #include "third_party/WebKit/WebKit/chromium/public/WebFileChooserCompletion.h"
30 #include "third_party/WebKit/WebKit/chromium/public/WebFileChooserParams.h" 31 #include "third_party/WebKit/WebKit/chromium/public/WebFileChooserParams.h"
31 #include "third_party/WebKit/WebKit/chromium/public/WebPluginContainer.h" 32 #include "third_party/WebKit/WebKit/chromium/public/WebPluginContainer.h"
32 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" 33 #include "third_party/WebKit/WebKit/chromium/public/WebView.h"
33 #include "webkit/fileapi/file_system_callback_dispatcher.h" 34 #include "webkit/fileapi/file_system_callback_dispatcher.h"
34 #include "webkit/glue/plugins/pepper_file_io.h" 35 #include "webkit/glue/plugins/pepper_file_io.h"
35 #include "webkit/glue/plugins/pepper_plugin_instance.h" 36 #include "webkit/glue/plugins/pepper_plugin_instance.h"
37 #include "webkit/glue/plugins/pepper_plugin_module.h"
36 #include "webkit/glue/plugins/webplugin.h" 38 #include "webkit/glue/plugins/webplugin.h"
37 39
38 #if defined(OS_MACOSX) 40 #if defined(OS_MACOSX)
39 #include "chrome/common/render_messages.h" 41 #include "chrome/common/render_messages.h"
40 #include "chrome/renderer/render_thread.h" 42 #include "chrome/renderer/render_thread.h"
41 #endif 43 #endif
42 44
43 using WebKit::WebView; 45 using WebKit::WebView;
44 46
45 namespace { 47 namespace {
46 48
47 const int32 kDefaultCommandBufferSize = 1024 * 1024; 49 const int32 kDefaultCommandBufferSize = 1024 * 1024;
48 50
49 // Implements the Image2D using a TransportDIB. 51 // Implements the Image2D using a TransportDIB.
50 class PlatformImage2DImpl : public pepper::PluginDelegate::PlatformImage2D { 52 class PlatformImage2DImpl : public pepper::PluginDelegate::PlatformImage2D {
51 public: 53 public:
52 // This constructor will take ownership of the dib pointer. 54 // This constructor will take ownership of the dib pointer.
53 PlatformImage2DImpl(int width, int height, TransportDIB* dib) 55 PlatformImage2DImpl(int width, int height, TransportDIB* dib)
54 : width_(width), 56 : width_(width),
55 height_(height), 57 height_(height),
56 dib_(dib) { 58 dib_(dib) {
57 } 59 }
58 60
59 virtual skia::PlatformCanvas* Map() { 61 virtual skia::PlatformCanvas* Map() {
60 return dib_->GetPlatformCanvas(width_, height_); 62 return dib_->GetPlatformCanvas(width_, height_);
61 } 63 }
62 64
63 virtual intptr_t GetSharedMemoryHandle() const { 65 virtual intptr_t GetSharedMemoryHandle() const {
64 return reinterpret_cast<intptr_t>(dib_.get()); 66 return static_cast<intptr_t>(dib_->handle());
65 } 67 }
66 68
67 virtual TransportDIB* GetTransportDIB() const { 69 virtual TransportDIB* GetTransportDIB() const {
68 return dib_.get(); 70 return dib_.get();
69 } 71 }
70 72
71 private: 73 private:
72 int width_; 74 int width_;
73 int height_; 75 int height_;
74 scoped_ptr<TransportDIB> dib_; 76 scoped_ptr<TransportDIB> dib_;
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 DISALLOW_COPY_AND_ASSIGN(PlatformVideoDecoderImpl); 490 DISALLOW_COPY_AND_ASSIGN(PlatformVideoDecoderImpl);
489 }; 491 };
490 492
491 } // namespace 493 } // namespace
492 494
493 PepperPluginDelegateImpl::PepperPluginDelegateImpl(RenderView* render_view) 495 PepperPluginDelegateImpl::PepperPluginDelegateImpl(RenderView* render_view)
494 : render_view_(render_view), 496 : render_view_(render_view),
495 id_generator_(0) { 497 id_generator_(0) {
496 } 498 }
497 499
498 PepperPluginDelegateImpl::~PepperPluginDelegateImpl() {} 500 PepperPluginDelegateImpl::~PepperPluginDelegateImpl() {
501 }
502
503 scoped_refptr<pepper::PluginModule>
504 PepperPluginDelegateImpl::CreateOutOfProcessPepperPlugin(
505 const FilePath& path) {
506 IPC::ChannelHandle channel_handle;
507 render_view_->Send(new ViewHostMsg_OpenChannelToPepperPlugin(
508 path, &channel_handle));
509 if (channel_handle.name.empty())
510 return scoped_refptr<pepper::PluginModule>(); // Couldn't be initialized.
511 return pepper::PluginModule::CreateOutOfProcessModule(
512 ChildProcess::current()->io_message_loop(),
513 channel_handle,
514 ChildProcess::current()->GetShutDownEvent());
515 }
499 516
500 void PepperPluginDelegateImpl::ViewInitiatedPaint() { 517 void PepperPluginDelegateImpl::ViewInitiatedPaint() {
501 // Notify all of our instances that we started painting. This is used for 518 // Notify all of our instances that we started painting. This is used for
502 // internal bookkeeping only, so we know that the set can not change under 519 // internal bookkeeping only, so we know that the set can not change under
503 // us. 520 // us.
504 for (std::set<pepper::PluginInstance*>::iterator i = 521 for (std::set<pepper::PluginInstance*>::iterator i =
505 active_instances_.begin(); 522 active_instances_.begin();
506 i != active_instances_.end(); ++i) 523 i != active_instances_.end(); ++i)
507 (*i)->ViewInitiatedPaint(); 524 (*i)->ViewInitiatedPaint();
508 } 525 }
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 } 917 }
901 918
902 void PepperPluginDelegateImpl::DidStopLoading() { 919 void PepperPluginDelegateImpl::DidStopLoading() {
903 render_view_->DidStopLoadingForPlugin(); 920 render_view_->DidStopLoadingForPlugin();
904 } 921 }
905 922
906 void PepperPluginDelegateImpl::SetContentRestriction(int restrictions) { 923 void PepperPluginDelegateImpl::SetContentRestriction(int restrictions) {
907 render_view_->Send(new ViewHostMsg_UpdateContentRestrictions( 924 render_view_->Send(new ViewHostMsg_UpdateContentRestrictions(
908 render_view_->routing_id(), restrictions)); 925 render_view_->routing_id(), restrictions));
909 } 926 }
OLDNEW
« no previous file with comments | « chrome/renderer/pepper_plugin_delegate_impl.h ('k') | chrome/renderer/render_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698