diff options
author | Ben Murdoch <benm@google.com> | 2010-11-25 19:40:10 +0000 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-12-03 13:52:53 +0000 |
commit | 4a5e2dc747d50c653511c68ccb2cfbfb740bd5a7 (patch) | |
tree | 938665d93a11fe7a6d0124e3c1e020d1f9d3f947 /webkit | |
parent | 7c627d87728a355737862918d144f98f69406954 (diff) | |
download | external_chromium-4a5e2dc747d50c653511c68ccb2cfbfb740bd5a7.zip external_chromium-4a5e2dc747d50c653511c68ccb2cfbfb740bd5a7.tar.gz external_chromium-4a5e2dc747d50c653511c68ccb2cfbfb740bd5a7.tar.bz2 |
Merge Chromium at r66597: Initial merge by git.
Change-Id: I9639f8a997f90ec219573aa22a49f5dbde78cc7b
Diffstat (limited to 'webkit')
29 files changed, 248 insertions, 336 deletions
diff --git a/webkit/glue/cpp_bound_class_unittest.cc b/webkit/glue/cpp_bound_class_unittest.cc index 71a56e6..f40b66b 100644 --- a/webkit/glue/cpp_bound_class_unittest.cc +++ b/webkit/glue/cpp_bound_class_unittest.cc @@ -238,7 +238,8 @@ TEST_F(CppBoundClassTest, InvokeMethods) { "example.echoValue()", "null", // Too few arguments "example.echoType(false)", "true", - "example.echoType(19)", "7", + // Re-enable after merging r72243. + //"example.echoType(19)", "3.14159", "example.echoType(9.876)", "3.14159", "example.echoType('test string')", "'Success!'", "example.echoType()", "null", // Too few arguments diff --git a/webkit/glue/dom_operations.cc b/webkit/glue/dom_operations.cc index 2d0fb68..07c43b2 100644 --- a/webkit/glue/dom_operations.cc +++ b/webkit/glue/dom_operations.cc @@ -7,8 +7,7 @@ #include <set> #include "base/compiler_specific.h" -#include "base/string_number_conversions.h" -#include "base/string_split.h" +#include "base/logging.h" #include "base/string_util.h" #include "third_party/WebKit/WebKit/chromium/public/WebAnimationController.h" #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" @@ -239,139 +238,6 @@ bool GetAllSavableResourceLinksForCurrentPage(WebView* view, return true; } -// Sizes a single size (the width or height) from a 'sizes' attribute. A size -// matches must match the following regex: [1-9][0-9]*. -static int ParseSingleIconSize(const string16& text) { - // Size must not start with 0, and be between 0 and 9. - if (text.empty() || !(text[0] >= L'1' && text[0] <= L'9')) - return 0; - // Make sure all chars are from 0-9. - for (size_t i = 1; i < text.length(); ++i) { - if (!(text[i] >= L'0' && text[i] <= L'9')) - return 0; - } - int output; - if (!base::StringToInt(text, &output)) - return 0; - return output; -} - -// Parses an icon size. An icon size must match the following regex: -// [1-9][0-9]*x[1-9][0-9]*. -// If the input couldn't be parsed, a size with a width/height < 0 is returned. -static gfx::Size ParseIconSize(const string16& text) { - std::vector<string16> sizes; - base::SplitStringDontTrim(text, L'x', &sizes); - if (sizes.size() != 2) - return gfx::Size(); - - return gfx::Size(ParseSingleIconSize(sizes[0]), - ParseSingleIconSize(sizes[1])); -} - -WebApplicationInfo::WebApplicationInfo() {} - -WebApplicationInfo::~WebApplicationInfo() {} - -bool ParseIconSizes(const string16& text, - std::vector<gfx::Size>* sizes, - bool* is_any) { - *is_any = false; - std::vector<string16> size_strings; - SplitStringAlongWhitespace(text, &size_strings); - for (size_t i = 0; i < size_strings.size(); ++i) { - if (EqualsASCII(size_strings[i], "any")) { - *is_any = true; - } else { - gfx::Size size = ParseIconSize(size_strings[i]); - if (size.width() <= 0 || size.height() <= 0) - return false; // Bogus size. - sizes->push_back(size); - } - } - if (*is_any && !sizes->empty()) { - // If is_any is true, it must occur by itself. - return false; - } - return (*is_any || !sizes->empty()); -} - -static void AddInstallIcon(const WebElement& link, - std::vector<WebApplicationInfo::IconInfo>* icons) { - WebString href = link.getAttribute("href"); - if (href.isNull() || href.isEmpty()) - return; - - // Get complete url. - GURL url = link.document().completeURL(href); - if (!url.is_valid()) - return; - - if (!link.hasAttribute("sizes")) - return; - - bool is_any = false; - std::vector<gfx::Size> icon_sizes; - if (!ParseIconSizes(link.getAttribute("sizes"), &icon_sizes, &is_any) || - is_any || - icon_sizes.size() != 1) { - return; - } - WebApplicationInfo::IconInfo icon_info; - icon_info.width = icon_sizes[0].width(); - icon_info.height = icon_sizes[0].height(); - icon_info.url = url; - icons->push_back(icon_info); -} - -void GetApplicationInfo(WebView* view, WebApplicationInfo* app_info) { - WebFrame* main_frame = view->mainFrame(); - if (!main_frame) - return; - - WebDocument doc = main_frame->document(); - if (doc.isNull()) - return; - - WebElement head = main_frame->document().head(); - if (head.isNull()) - return; - - WebNodeList children = head.childNodes(); - for (unsigned i = 0; i < children.length(); ++i) { - WebNode child = children.item(i); - if (!child.isElementNode()) - continue; - WebElement elem = child.to<WebElement>(); - - if (elem.hasTagName("link")) { - std::string rel = elem.getAttribute("rel").utf8(); - // "rel" attribute may use either "icon" or "shortcut icon". - // see also - // <http://en.wikipedia.org/wiki/Favicon> - // <http://dev.w3.org/html5/spec/Overview.html#rel-icon> - if (LowerCaseEqualsASCII(rel, "icon") || - LowerCaseEqualsASCII(rel, "shortcut icon")) - AddInstallIcon(elem, &app_info->icons); - } else if (elem.hasTagName("meta") && elem.hasAttribute("name")) { - std::string name = elem.getAttribute("name").utf8(); - WebString content = elem.getAttribute("content"); - if (name == "application-name") { - app_info->title = content; - } else if (name == "description") { - app_info->description = content; - } else if (name == "application-url") { - std::string url = content.utf8(); - GURL main_url = main_frame->url(); - app_info->app_url = main_url.is_valid() ? - main_url.Resolve(url) : GURL(url); - if (!app_info->app_url.is_valid()) - app_info->app_url = GURL(); - } - } - } -} - bool PauseAnimationAtTimeOnElementWithId(WebView* view, const std::string& animation_name, double time, diff --git a/webkit/glue/dom_operations.h b/webkit/glue/dom_operations.h index 951eb0f..924878f 100644 --- a/webkit/glue/dom_operations.h +++ b/webkit/glue/dom_operations.h @@ -8,7 +8,6 @@ #include <string> #include <vector> -#include "gfx/size.h" #include "googleurl/src/gurl.h" namespace WebKit { @@ -54,48 +53,6 @@ bool GetAllSavableResourceLinksForCurrentPage(WebKit::WebView* view, const GURL& page_url, SavableResourcesResult* savable_resources_result, const char** savable_schemes); -// Structure used when installing a web page as an app. Populated via -// GetApplicationInfo. -struct WebApplicationInfo { - WebApplicationInfo(); - ~WebApplicationInfo(); - - struct IconInfo { - GURL url; - int width; - int height; - }; - - // Title of the application. This is set from the meta tag whose name is - // 'application-name'. - string16 title; - - // Description of the application. This is set from the meta tag whose name - // is 'description'. - string16 description; - - // URL for the app. This is set from the meta tag whose name is - // 'application-url'. - GURL app_url; - - // Set of available icons. This is set for all link tags whose rel=icon. Only - // icons that have a non-zero (width and/or height) are added. - std::vector<IconInfo> icons; -}; - -// Parses the icon's size attribute as defined in the HTML 5 spec. Returns true -// on success, false on errors. On success either all the sizes specified in -// the attribute are added to sizes, or is_any is set to true. -// -// You shouldn't have a need to invoke this directly, it's public for testing. -bool ParseIconSizes(const string16& text, - std::vector<gfx::Size>* sizes, - bool* is_any); - -// Gets the application info for the specified page. See the description of -// WebApplicationInfo for details as to where each field comes from. -void GetApplicationInfo(WebKit::WebView* view, WebApplicationInfo* app_info); - // Invokes pauseAnimationAtTime on the AnimationController associated with the // |view|s main frame. // This is used by test shell. diff --git a/webkit/glue/dom_operations_unittest.cc b/webkit/glue/dom_operations_unittest.cc index c57e943..fac49c6 100644 --- a/webkit/glue/dom_operations_unittest.cc +++ b/webkit/glue/dom_operations_unittest.cc @@ -128,58 +128,4 @@ TEST_F(DomOperationsTests, GetSavableResourceLinksWithPageHasInvalidLinks) { GetSavableResourceLinksForPage(page_file_path, expected_resources_set); } -// Tests ParseIconSizes with various input. -TEST_F(DomOperationsTests, ParseIconSizes) { - struct TestData { - const char* input; - const bool expected_result; - const bool is_any; - const size_t expected_size_count; - const int width1; - const int height1; - const int width2; - const int height2; - } data[] = { - // Bogus input cases. - { "10", false, false, 0, 0, 0, 0, 0 }, - { "10 10", false, false, 0, 0, 0, 0, 0 }, - { "010", false, false, 0, 0, 0, 0, 0 }, - { " 010 ", false, false, 0, 0, 0, 0, 0 }, - { " 10x ", false, false, 0, 0, 0, 0, 0 }, - { " x10 ", false, false, 0, 0, 0, 0, 0 }, - { "any 10x10", false, false, 0, 0, 0, 0, 0 }, - { "", false, false, 0, 0, 0, 0, 0 }, - { "10ax11", false, false, 0, 0, 0, 0, 0 }, - - // Any. - { "any", true, true, 0, 0, 0, 0, 0 }, - { " any", true, true, 0, 0, 0, 0, 0 }, - { " any ", true, true, 0, 0, 0, 0, 0 }, - - // Sizes. - { "10x11", true, false, 1, 10, 11, 0, 0 }, - { " 10x11 ", true, false, 1, 10, 11, 0, 0 }, - { " 10x11 1x2", true, false, 2, 10, 11, 1, 2 }, - }; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) { - bool is_any; - std::vector<gfx::Size> sizes; - bool result = webkit_glue::ParseIconSizes( - ASCIIToUTF16(data[i].input), &sizes, &is_any); - ASSERT_EQ(result, data[i].expected_result); - if (result) { - ASSERT_EQ(data[i].is_any, is_any); - ASSERT_EQ(data[i].expected_size_count, sizes.size()); - if (sizes.size() > 0) { - ASSERT_EQ(data[i].width1, sizes[0].width()); - ASSERT_EQ(data[i].height1, sizes[0].height()); - } - if (sizes.size() > 1) { - ASSERT_EQ(data[i].width2, sizes[1].width()); - ASSERT_EQ(data[i].height2, sizes[1].height()); - } - } - } -} - } // namespace diff --git a/webkit/glue/plugins/pepper_file_chooser.cc b/webkit/glue/plugins/pepper_file_chooser.cc index fd3ade1..2b54790 100644 --- a/webkit/glue/plugins/pepper_file_chooser.cc +++ b/webkit/glue/plugins/pepper_file_chooser.cc @@ -38,6 +38,10 @@ PP_Resource Create(PP_Instance instance_id, if (!instance) return 0; + if ((options->mode != PP_FILECHOOSERMODE_OPEN) && + (options->mode != PP_FILECHOOSERMODE_OPENMULTIPLE)) + return 0; + FileChooser* chooser = new FileChooser(instance, options); return chooser->GetReference(); } diff --git a/webkit/glue/plugins/pepper_file_ref.cc b/webkit/glue/plugins/pepper_file_ref.cc index 67e39e3..6068a29 100644 --- a/webkit/glue/plugins/pepper_file_ref.cc +++ b/webkit/glue/plugins/pepper_file_ref.cc @@ -266,8 +266,18 @@ const PPB_FileRef_Dev* FileRef::GetInterface() { } std::string FileRef::GetName() const { - if (GetFileSystemType() == PP_FILESYSTEMTYPE_EXTERNAL) - return std::string(); + if (GetFileSystemType() == PP_FILESYSTEMTYPE_EXTERNAL) { + FilePath::StringType path = system_path_.value(); + size_t pos = path.rfind(FilePath::kSeparators[0]); + DCHECK(pos != FilePath::StringType::npos); +#if defined(OS_WIN) + return WideToUTF8(path.substr(pos + 1)); +#elif defined(OS_POSIX) + return path.substr(pos + 1); +#else +#error "Unsupported platform." +#endif + } if (virtual_path_.size() == 1 && virtual_path_[0] == '/') return virtual_path_; diff --git a/webkit/glue/plugins/pepper_graphics_2d.cc b/webkit/glue/plugins/pepper_graphics_2d.cc index a8d5091..7ccfae5 100644 --- a/webkit/glue/plugins/pepper_graphics_2d.cc +++ b/webkit/glue/plugins/pepper_graphics_2d.cc @@ -299,7 +299,7 @@ void Graphics2D::Scroll(const PP_Rect* clip_rect, const PP_Point* amount) { int32 dx = amount->x; int32 dy = amount->y; if (dx <= -image_data_->width() || dx >= image_data_->width() || - dx <= -image_data_->height() || dy >= image_data_->height()) + dy <= -image_data_->height() || dy >= image_data_->height()) return; operation.scroll_dx = dx; @@ -420,6 +420,7 @@ bool Graphics2D::ReadImageData(PP_Resource image, SkIntToScalar(image_resource->width()), SkIntToScalar(image_resource->height()) }; + ImageDataAutoMapper auto_mapper2(image_data_); if (image_resource->format() != image_data_->format()) { // Convert the image data if the format does not match. ConvertImageData(image_data_, src_irect, image_resource.get(), dest_rect); @@ -472,7 +473,7 @@ bool Graphics2D::BindToInstance(PluginInstance* new_instance) { void Graphics2D::Paint(WebKit::WebCanvas* canvas, const gfx::Rect& plugin_rect, const gfx::Rect& paint_rect) { - // We're guaranteed to have a mapped canvas since we mapped it in Init(). + ImageDataAutoMapper auto_mapper(image_data_); const SkBitmap& backing_bitmap = *image_data_->GetMappedBitmap(); #if defined(OS_MACOSX) diff --git a/webkit/glue/plugins/pepper_graphics_3d_gl.cc b/webkit/glue/plugins/pepper_graphics_3d_gl.cc index 2ce8de0..6c301e4 100644 --- a/webkit/glue/plugins/pepper_graphics_3d_gl.cc +++ b/webkit/glue/plugins/pepper_graphics_3d_gl.cc @@ -550,8 +550,13 @@ void* MapTexSubImage2D( void UnmapTexSubImage2D(const void* mem) { Graphics3D::GetCurrent()->impl()->UnmapTexSubImage2D(mem); } +void CopyTextureToParentTexture( + GLuint client_child_id, GLuint client_parent_id) { + Graphics3D::GetCurrent()->impl()->CopyTextureToParentTexture( + client_child_id, client_parent_id); +} -const PPB_OpenGLES_Dev ppb_opengles = { +const struct PPB_OpenGLES_Dev ppb_opengles = { &ActiveTexture, &AttachShader, &BindAttribLocation, @@ -703,7 +708,8 @@ const PPB_OpenGLES_Dev ppb_opengles = { &MapBufferSubData, &UnmapBufferSubData, &MapTexSubImage2D, - &UnmapTexSubImage2D + &UnmapTexSubImage2D, + &CopyTextureToParentTexture }; } // namespace diff --git a/webkit/glue/plugins/pepper_plugin_instance.cc b/webkit/glue/plugins/pepper_plugin_instance.cc index 47ea900..b4cd681 100644 --- a/webkit/glue/plugins/pepper_plugin_instance.cc +++ b/webkit/glue/plugins/pepper_plugin_instance.cc @@ -437,7 +437,6 @@ bool PluginInstance::BindGraphics(PP_Resource graphics_id) { if (graphics_2d) { if (!graphics_2d->BindToInstance(this)) return false; // Can't bind to more than one instance. - bound_graphics_ = graphics_2d; // See http://crbug.com/49403: this can be further optimized by keeping the // old device around and painting from it. @@ -458,6 +457,7 @@ bool PluginInstance::BindGraphics(PP_Resource graphics_id) { canvas.drawARGB(255, 255, 255, 255); } + bound_graphics_ = graphics_2d; // BindToInstance will have invalidated the plugin if necessary. } else if (graphics_3d) { if (!graphics_3d->BindToInstance(this)) diff --git a/webkit/glue/plugins/pepper_plugin_module.cc b/webkit/glue/plugins/pepper_plugin_module.cc index 662055a..b7bad9f 100644 --- a/webkit/glue/plugins/pepper_plugin_module.cc +++ b/webkit/glue/plugins/pepper_plugin_module.cc @@ -27,16 +27,11 @@ #include "ppapi/c/dev/ppb_scrollbar_dev.h" #include "ppapi/c/dev/ppb_testing_dev.h" #include "ppapi/c/dev/ppb_transport_dev.h" -#include "ppapi/c/dev/ppb_url_loader_dev.h" -#include "ppapi/c/dev/ppb_url_loader_trusted_dev.h" -#include "ppapi/c/dev/ppb_url_request_info_dev.h" -#include "ppapi/c/dev/ppb_url_response_info_dev.h" #include "ppapi/c/dev/ppb_url_util_dev.h" #include "ppapi/c/dev/ppb_var_deprecated.h" #include "ppapi/c/dev/ppb_video_decoder_dev.h" #include "ppapi/c/dev/ppb_widget_dev.h" #include "ppapi/c/dev/ppb_zoom_dev.h" -#include "ppapi/c/trusted/ppb_image_data_trusted.h" #include "ppapi/c/pp_module.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_var.h" @@ -45,9 +40,16 @@ #include "ppapi/c/ppb_graphics_2d.h" #include "ppapi/c/ppb_image_data.h" #include "ppapi/c/ppb_instance.h" +#include "ppapi/c/ppb_url_loader.h" +#include "ppapi/c/ppb_url_request_info.h" +#include "ppapi/c/ppb_url_response_info.h" #include "ppapi/c/ppb_var.h" #include "ppapi/c/ppp.h" #include "ppapi/c/ppp_instance.h" +#include "ppapi/c/trusted/ppb_image_data_trusted.h" +#include "ppapi/c/trusted/ppb_url_loader_trusted.h" +#include "ppapi/proxy/host_dispatcher.h" +#include "ppapi/proxy/ppapi_messages.h" #include "webkit/glue/plugins/pepper_audio.h" #include "webkit/glue/plugins/pepper_buffer.h" #include "webkit/glue/plugins/pepper_common.h" @@ -83,6 +85,10 @@ #include "webkit/glue/plugins/pepper_graphics_3d.h" #endif // ENABLE_GPU +#if defined(OS_POSIX) +#include "ipc/ipc_channel_posix.h" +#endif + namespace pepper { namespace { @@ -227,13 +233,13 @@ const void* GetInterface(const char* name) { #endif // ENABLE_GPU if (strcmp(name, PPB_TRANSPORT_DEV_INTERFACE) == 0) return Transport::GetInterface(); - if (strcmp(name, PPB_URLLOADER_DEV_INTERFACE) == 0) + if (strcmp(name, PPB_URLLOADER_INTERFACE) == 0) return URLLoader::GetInterface(); - if (strcmp(name, PPB_URLLOADERTRUSTED_DEV_INTERFACE) == 0) + if (strcmp(name, PPB_URLLOADERTRUSTED_INTERFACE) == 0) return URLLoader::GetTrustedInterface(); - if (strcmp(name, PPB_URLREQUESTINFO_DEV_INTERFACE) == 0) + if (strcmp(name, PPB_URLREQUESTINFO_INTERFACE) == 0) return URLRequestInfo::GetInterface(); - if (strcmp(name, PPB_URLRESPONSEINFO_DEV_INTERFACE) == 0) + if (strcmp(name, PPB_URLRESPONSEINFO_INTERFACE) == 0) return URLResponseInfo::GetInterface(); if (strcmp(name, PPB_BUFFER_DEV_INTERFACE) == 0) return Buffer::GetInterface(); @@ -335,6 +341,7 @@ scoped_refptr<PluginModule> PluginModule::CreateModule( return lib; } +// static scoped_refptr<PluginModule> PluginModule::CreateInternalModule( EntryPoints entry_points) { scoped_refptr<PluginModule> lib(new PluginModule()); @@ -345,6 +352,17 @@ scoped_refptr<PluginModule> PluginModule::CreateInternalModule( } // static +scoped_refptr<PluginModule> PluginModule::CreateOutOfProcessModule( + MessageLoop* ipc_message_loop, + const IPC::ChannelHandle& handle, + base::WaitableEvent* shutdown_event) { + scoped_refptr<PluginModule> lib(new PluginModule); + if (!lib->InitForOutOfProcess(ipc_message_loop, handle, shutdown_event)) + return NULL; + return lib; +} + +// static const PPB_Core* PluginModule::GetCore() { return &core_interface; } @@ -386,10 +404,41 @@ bool PluginModule::InitFromFile(const FilePath& path) { return true; } +bool PluginModule::InitForOutOfProcess(MessageLoop* ipc_message_loop, + const IPC::ChannelHandle& handle, + base::WaitableEvent* shutdown_event) { + const PPB_Var_Deprecated* var_interface = + reinterpret_cast<const PPB_Var_Deprecated*>( + GetInterface(PPB_VAR_DEPRECATED_INTERFACE)); + dispatcher_.reset(new pp::proxy::HostDispatcher(var_interface, + pp_module(), &GetInterface)); + +#if defined(OS_POSIX) + // If we received a ChannelHandle, register it now. + if (handle.socket.fd >= 0) + IPC::AddChannelSocket(handle.name, handle.socket.fd); +#endif + + if (!dispatcher_->InitWithChannel(ipc_message_loop, handle.name, true, + shutdown_event)) { + dispatcher_.reset(); + return false; + } + + bool init_result = false; + dispatcher_->Send(new PpapiMsg_InitializeModule(pp_module(), &init_result)); + + if (!init_result) { + // TODO(brettw) does the module get unloaded in this case? + dispatcher_.reset(); + return false; + } + return true; +} + // static bool PluginModule::LoadEntryPoints(const base::NativeLibrary& library, EntryPoints* entry_points) { - entry_points->get_interface = reinterpret_cast<PPP_GetInterfaceFunc>( base::GetFunctionPointerFromNativeLibrary(library, @@ -426,7 +475,13 @@ PluginInstance* PluginModule::CreateInstance(PluginDelegate* delegate) { LOG(WARNING) << "Plugin doesn't support instance interface, failing."; return NULL; } - return new PluginInstance(delegate, this, plugin_instance_interface); + PluginInstance* instance = new PluginInstance(delegate, this, + plugin_instance_interface); + if (dispatcher_.get()) { + pp::proxy::HostDispatcher::SetForInstance(instance->pp_instance(), + dispatcher_.get()); + } + return instance; } PluginInstance* PluginModule::GetSomeInstance() const { @@ -437,6 +492,10 @@ PluginInstance* PluginModule::GetSomeInstance() const { } const void* PluginModule::GetPluginInterface(const char* name) const { + if (dispatcher_.get()) + return dispatcher_->GetProxiedInterface(name); + + // In-process plugins. if (!entry_points_.get_interface) return NULL; return entry_points_.get_interface(name); @@ -447,6 +506,7 @@ void PluginModule::InstanceCreated(PluginInstance* instance) { } void PluginModule::InstanceDeleted(PluginInstance* instance) { + pp::proxy::HostDispatcher::RemoveForInstance(instance->pp_instance()); instances_.erase(instance); } diff --git a/webkit/glue/plugins/pepper_plugin_module.h b/webkit/glue/plugins/pepper_plugin_module.h index cf7defb..6ba3146 100644 --- a/webkit/glue/plugins/pepper_plugin_module.h +++ b/webkit/glue/plugins/pepper_plugin_module.h @@ -16,10 +16,25 @@ #include "ppapi/c/ppb.h" class FilePath; +class MessageLoop; typedef struct NPObject NPObject; struct PPB_Core; typedef void* NPIdentifier; +namespace base { +class WaitableEvent; +} + +namespace pp { +namespace proxy { +class HostDispatcher; +} // proxy +} // pp + +namespace IPC { +struct ChannelHandle; +} + namespace pepper { class ObjectVar; @@ -56,6 +71,10 @@ class PluginModule : public base::RefCounted<PluginModule>, static scoped_refptr<PluginModule> CreateModule(const FilePath& path); static scoped_refptr<PluginModule> CreateInternalModule( EntryPoints entry_points); + static scoped_refptr<PluginModule> CreateOutOfProcessModule( + MessageLoop* ipc_message_loop, + const IPC::ChannelHandle& handle, + base::WaitableEvent* shutdown_event); static const PPB_Core* GetCore(); @@ -101,9 +120,16 @@ class PluginModule : public base::RefCounted<PluginModule>, bool InitFromEntryPoints(const EntryPoints& entry_points); bool InitFromFile(const FilePath& path); + bool InitForOutOfProcess(MessageLoop* ipc_message_loop, + const IPC::ChannelHandle& handle, + base::WaitableEvent* shutdown_event); static bool LoadEntryPoints(const base::NativeLibrary& library, EntryPoints* entry_points); + // Dispatcher for out-of-process plugins. This will be null when the plugin + // is being run in-process. + scoped_ptr<pp::proxy::HostDispatcher> dispatcher_; + PP_Module pp_module_; bool initialized_; @@ -115,7 +141,7 @@ class PluginModule : public base::RefCounted<PluginModule>, base::NativeLibrary library_; // Contains pointers to the entry points of the actual plugin - // implementation. + // implementation. These will be NULL for out-of-process plugins. EntryPoints entry_points_; // The name of the module. diff --git a/webkit/glue/plugins/pepper_url_loader.cc b/webkit/glue/plugins/pepper_url_loader.cc index c9a580a..2d94172 100644 --- a/webkit/glue/plugins/pepper_url_loader.cc +++ b/webkit/glue/plugins/pepper_url_loader.cc @@ -7,8 +7,8 @@ #include "base/logging.h" #include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_errors.h" -#include "ppapi/c/dev/ppb_url_loader_dev.h" -#include "ppapi/c/dev/ppb_url_loader_trusted_dev.h" +#include "ppapi/c/ppb_url_loader.h" +#include "ppapi/c/trusted/ppb_url_loader_trusted.h" #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/WebKit/chromium/public/WebElement.h" #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" @@ -142,7 +142,7 @@ void Close(PP_Resource loader_id) { loader->Close(); } -const PPB_URLLoader_Dev ppb_urlloader = { +const PPB_URLLoader ppb_urlloader = { &Create, &IsURLLoader, &Open, @@ -171,7 +171,7 @@ void SetStatusCallback(PP_Resource loader_id, loader->SetStatusCallback(cb); } -const PPB_URLLoaderTrusted_Dev ppb_urlloadertrusted = { +const PPB_URLLoaderTrusted ppb_urlloadertrusted = { &GrantUniversalAccess, &SetStatusCallback }; @@ -194,8 +194,6 @@ URLLoader::URLLoader(PluginInstance* instance, bool main_document_loader) user_buffer_(NULL), user_buffer_size_(0), done_status_(PP_ERROR_WOULDBLOCK), - record_download_progress_(false), - record_upload_progress_(false), has_universal_access_(false), status_callback_(NULL) { instance->AddObserver(this); @@ -207,12 +205,12 @@ URLLoader::~URLLoader() { } // static -const PPB_URLLoader_Dev* URLLoader::GetInterface() { +const PPB_URLLoader* URLLoader::GetInterface() { return &ppb_urlloader; } // static -const PPB_URLLoaderTrusted_Dev* URLLoader::GetTrustedInterface() { +const PPB_URLLoaderTrusted* URLLoader::GetTrustedInterface() { return &ppb_urlloadertrusted; } @@ -250,8 +248,6 @@ int32_t URLLoader::Open(URLRequestInfo* request, request_info_ = scoped_refptr<URLRequestInfo>(request); pending_callback_ = callback; - record_download_progress_ = request->record_download_progress(); - record_upload_progress_ = request->record_upload_progress(); // Notify completion when we receive a redirect or response headers. return PP_ERROR_WOULDBLOCK; @@ -278,7 +274,7 @@ int32_t URLLoader::FollowRedirect(PP_CompletionCallback callback) { bool URLLoader::GetUploadProgress(int64_t* bytes_sent, int64_t* total_bytes_to_be_sent) { - if (!record_upload_progress_) { + if (!RecordUploadProgress()) { *bytes_sent = 0; *total_bytes_to_be_sent = 0; return false; @@ -290,7 +286,7 @@ bool URLLoader::GetUploadProgress(int64_t* bytes_sent, bool URLLoader::GetDownloadProgress(int64_t* bytes_received, int64_t* total_bytes_to_be_received) { - if (!record_download_progress_) { + if (!RecordDownloadProgress()) { *bytes_received = 0; *total_bytes_to_be_received = 0; return false; @@ -503,7 +499,7 @@ int32_t URLLoader::CanRequest(const WebKit::WebFrame* frame, void URLLoader::UpdateStatus() { if (status_callback_ && - (record_download_progress_ || record_upload_progress_)) { + (RecordDownloadProgress() || RecordUploadProgress())) { PP_Resource pp_resource = GetReferenceNoAddRef(); if (pp_resource) { // The PP_Resource on the plugin will be NULL if the plugin has no @@ -517,12 +513,20 @@ void URLLoader::UpdateStatus() { // flag. status_callback_( instance_->pp_instance(), pp_resource, - record_upload_progress_ ? bytes_sent_ : -1, - record_upload_progress_ ? total_bytes_to_be_sent_ : -1, - record_download_progress_ ? bytes_received_ : -1, - record_download_progress_ ? total_bytes_to_be_received_ : -1); + RecordUploadProgress() ? bytes_sent_ : -1, + RecordUploadProgress() ? total_bytes_to_be_sent_ : -1, + RecordDownloadProgress() ? bytes_received_ : -1, + RecordDownloadProgress() ? total_bytes_to_be_received_ : -1); } } } +bool URLLoader::RecordDownloadProgress() const { + return request_info_ && request_info_->record_download_progress(); +} + +bool URLLoader::RecordUploadProgress() const { + return request_info_ && request_info_->record_upload_progress(); +} + } // namespace pepper diff --git a/webkit/glue/plugins/pepper_url_loader.h b/webkit/glue/plugins/pepper_url_loader.h index dd91708..ee8ddd7 100644 --- a/webkit/glue/plugins/pepper_url_loader.h +++ b/webkit/glue/plugins/pepper_url_loader.h @@ -9,13 +9,13 @@ #include "base/scoped_ptr.h" #include "ppapi/c/pp_completion_callback.h" -#include "ppapi/c/dev/ppb_url_loader_trusted_dev.h" +#include "ppapi/c/trusted/ppb_url_loader_trusted.h" #include "third_party/WebKit/WebKit/chromium/public/WebURLLoaderClient.h" #include "webkit/glue/plugins/pepper_plugin_instance.h" #include "webkit/glue/plugins/pepper_resource.h" -struct PPB_URLLoader_Dev; -struct PPB_URLLoaderTrusted_Dev; +struct PPB_URLLoader; +struct PPB_URLLoaderTrusted; namespace WebKit { class WebFrame; @@ -37,11 +37,11 @@ class URLLoader : public Resource, // Returns a pointer to the interface implementing PPB_URLLoader that is // exposed to the plugin. - static const PPB_URLLoader_Dev* GetInterface(); + static const PPB_URLLoader* GetInterface(); // Returns a pointer to the interface implementing PPB_URLLoaderTrusted that // is exposed to the plugin. - static const PPB_URLLoaderTrusted_Dev* GetTrustedInterface(); + static const PPB_URLLoaderTrusted* GetTrustedInterface(); // Resource overrides. URLLoader* AsURLLoader() { return this; } @@ -100,6 +100,14 @@ class URLLoader : public Resource, // synchronize an out-of-process plugin's state. void UpdateStatus(); + // Returns true if the plugin has requested we record download or upload + // progress. When false, we don't need to update the counters. We go out of + // our way not to allow access to this information unless it's requested, + // even when it would be easier just to return it and not check, so that + // plugins don't depend on access without setting the flag. + bool RecordDownloadProgress() const; + bool RecordUploadProgress() const; + // This will be NULL if the instance has been deleted but this URLLoader was // somehow leaked. In general, you should not need to check this for NULL. // However, if you see a NULL pointer crash, that means somebody is holding @@ -122,9 +130,6 @@ class URLLoader : public Resource, size_t user_buffer_size_; int32_t done_status_; - bool record_download_progress_; - bool record_upload_progress_; - bool has_universal_access_; PP_URLLoaderTrusted_StatusCallback status_callback_; diff --git a/webkit/glue/plugins/pepper_url_request_info.cc b/webkit/glue/plugins/pepper_url_request_info.cc index ae0c280..f606509 100644 --- a/webkit/glue/plugins/pepper_url_request_info.cc +++ b/webkit/glue/plugins/pepper_url_request_info.cc @@ -62,7 +62,7 @@ PP_Bool IsURLRequestInfo(PP_Resource resource) { } PP_Bool SetProperty(PP_Resource request_id, - PP_URLRequestProperty_Dev property, + PP_URLRequestProperty property, PP_Var var) { scoped_refptr<URLRequestInfo> request( Resource::GetAs<URLRequestInfo>(request_id)); @@ -117,7 +117,7 @@ PP_Bool AppendFileToBody(PP_Resource request_id, expected_last_modified_time)); } -const PPB_URLRequestInfo_Dev ppb_urlrequestinfo = { +const PPB_URLRequestInfo ppb_urlrequestinfo = { &Create, &IsURLRequestInfo, &SetProperty, @@ -164,11 +164,11 @@ URLRequestInfo::~URLRequestInfo() { } // static -const PPB_URLRequestInfo_Dev* URLRequestInfo::GetInterface() { +const PPB_URLRequestInfo* URLRequestInfo::GetInterface() { return &ppb_urlrequestinfo; } -bool URLRequestInfo::SetBooleanProperty(PP_URLRequestProperty_Dev property, +bool URLRequestInfo::SetBooleanProperty(PP_URLRequestProperty property, bool value) { switch (property) { case PP_URLREQUESTPROPERTY_STREAMTOFILE: @@ -189,7 +189,7 @@ bool URLRequestInfo::SetBooleanProperty(PP_URLRequestProperty_Dev property, } } -bool URLRequestInfo::SetStringProperty(PP_URLRequestProperty_Dev property, +bool URLRequestInfo::SetStringProperty(PP_URLRequestProperty property, const std::string& value) { // TODO(darin): Validate input. Perhaps at a different layer? switch (property) { diff --git a/webkit/glue/plugins/pepper_url_request_info.h b/webkit/glue/plugins/pepper_url_request_info.h index 4fd4e26..7aa9fc1 100644 --- a/webkit/glue/plugins/pepper_url_request_info.h +++ b/webkit/glue/plugins/pepper_url_request_info.h @@ -9,7 +9,7 @@ #include <vector> #include "base/ref_counted.h" -#include "ppapi/c/dev/ppb_url_request_info_dev.h" +#include "ppapi/c/ppb_url_request_info.h" #include "webkit/glue/plugins/pepper_file_ref.h" #include "webkit/glue/plugins/pepper_resource.h" @@ -27,14 +27,14 @@ class URLRequestInfo : public Resource { // Returns a pointer to the interface implementing PPB_URLRequestInfo that is // exposed to the plugin. - static const PPB_URLRequestInfo_Dev* GetInterface(); + static const PPB_URLRequestInfo* GetInterface(); // Resource overrides. URLRequestInfo* AsURLRequestInfo() { return this; } // PPB_URLRequestInfo implementation. - bool SetBooleanProperty(PP_URLRequestProperty_Dev property, bool value); - bool SetStringProperty(PP_URLRequestProperty_Dev property, + bool SetBooleanProperty(PP_URLRequestProperty property, bool value); + bool SetStringProperty(PP_URLRequestProperty property, const std::string& value); bool AppendDataToBody(const std::string& data); bool AppendFileToBody(FileRef* file_ref, diff --git a/webkit/glue/plugins/pepper_url_response_info.cc b/webkit/glue/plugins/pepper_url_response_info.cc index 2e7202f..5ae484f 100644 --- a/webkit/glue/plugins/pepper_url_response_info.cc +++ b/webkit/glue/plugins/pepper_url_response_info.cc @@ -44,7 +44,7 @@ PP_Bool IsURLResponseInfo(PP_Resource resource) { } PP_Var GetProperty(PP_Resource response_id, - PP_URLResponseProperty_Dev property) { + PP_URLResponseProperty property) { scoped_refptr<URLResponseInfo> response( Resource::GetAs<URLResponseInfo>(response_id)); if (!response) @@ -67,7 +67,7 @@ PP_Resource GetBody(PP_Resource response_id) { return body->GetReference(); } -const PPB_URLResponseInfo_Dev ppb_urlresponseinfo = { +const PPB_URLResponseInfo ppb_urlresponseinfo = { &IsURLResponseInfo, &GetProperty, &GetBody @@ -88,11 +88,11 @@ URLResponseInfo::~URLResponseInfo() { } // static -const PPB_URLResponseInfo_Dev* URLResponseInfo::GetInterface() { +const PPB_URLResponseInfo* URLResponseInfo::GetInterface() { return &ppb_urlresponseinfo; } -PP_Var URLResponseInfo::GetProperty(PP_URLResponseProperty_Dev property) { +PP_Var URLResponseInfo::GetProperty(PP_URLResponseProperty property) { switch (property) { case PP_URLRESPONSEPROPERTY_URL: return StringVar::StringToPPVar(module(), url_); diff --git a/webkit/glue/plugins/pepper_url_response_info.h b/webkit/glue/plugins/pepper_url_response_info.h index ff3a832..adbf8ef 100644 --- a/webkit/glue/plugins/pepper_url_response_info.h +++ b/webkit/glue/plugins/pepper_url_response_info.h @@ -7,7 +7,7 @@ #include <string> -#include "ppapi/c/dev/ppb_url_response_info_dev.h" +#include "ppapi/c/ppb_url_response_info.h" #include "webkit/glue/plugins/pepper_resource.h" namespace WebKit { @@ -23,13 +23,13 @@ class URLResponseInfo : public Resource { // Returns a pointer to the interface implementing PPB_URLResponseInfo that // is exposed to the plugin. - static const PPB_URLResponseInfo_Dev* GetInterface(); + static const PPB_URLResponseInfo* GetInterface(); // Resource overrides. URLResponseInfo* AsURLResponseInfo() { return this; } // PPB_URLResponseInfo implementation. - PP_Var GetProperty(PP_URLResponseProperty_Dev property); + PP_Var GetProperty(PP_URLResponseProperty property); bool Initialize(const WebKit::WebURLResponse& response); diff --git a/webkit/glue/plugins/plugin_host.cc b/webkit/glue/plugins/plugin_host.cc index 7cf93ed..4cee55d 100644 --- a/webkit/glue/plugins/plugin_host.cc +++ b/webkit/glue/plugins/plugin_host.cc @@ -134,6 +134,10 @@ void PluginHost::InitializeHostFuncs() { host_funcs_.unscheduletimer = NPN_UnscheduleTimer; host_funcs_.popupcontextmenu = NPN_PopUpContextMenu; host_funcs_.convertpoint = NPN_ConvertPoint; + host_funcs_.handleevent = NPN_HandleEvent; + host_funcs_.unfocusinstance = NPN_UnfocusInstance; + // TODO: Implement redirect handling: http://crbug.com/63030 + host_funcs_.urlredirectresponse = NULL; } void PluginHost::PatchNPNetscapeFuncs(NPNetscapeFuncs* overrides) { @@ -1086,4 +1090,17 @@ NPBool NPN_ConvertPoint(NPP id, double sourceX, double sourceY, return false; } +NPBool NPN_HandleEvent(NPP id, void *event, NPBool handled) { + // TODO: Implement advanced key handling: http://crbug.com/46578 + NOTIMPLEMENTED(); + return false; +} + +NPBool NPN_UnfocusInstance(NPP id, NPFocusDirection direction) { + // TODO: Implement advanced key handling: http://crbug.com/46578 + NOTIMPLEMENTED(); + return false; +} + + } // extern "C" diff --git a/webkit/glue/plugins/plugin_lib.cc b/webkit/glue/plugins/plugin_lib.cc index ee613c1..292cd63 100644 --- a/webkit/glue/plugins/plugin_lib.cc +++ b/webkit/glue/plugins/plugin_lib.cc @@ -235,25 +235,41 @@ bool PluginLib::Load() { // This class implements delayed NP_Shutdown and FreeLibrary on the plugin dll. class FreePluginLibraryTask : public Task { public: - FreePluginLibraryTask(base::NativeLibrary library, + FreePluginLibraryTask(const FilePath& path, + base::NativeLibrary library, NP_ShutdownFunc shutdown_func) - : library_(library), + : path_(path), + library_(library), NP_Shutdown_(shutdown_func) { } ~FreePluginLibraryTask() {} void Run() { - if (NP_Shutdown_) - NP_Shutdown_(); + if (NP_Shutdown_) { + // Don't call NP_Shutdown if the library has been reloaded since this task + // was posted. + bool reloaded = false; + if (g_loaded_libs) { + for (size_t i = 0; i < g_loaded_libs->size(); ++i) { + if ((*g_loaded_libs)[i]->plugin_info().path == path_) + reloaded = true; + } + } + if (!reloaded) + NP_Shutdown_(); + } if (library_) { + // Always call base::UnloadNativeLibrary so that the system reference + // count is decremented. base::UnloadNativeLibrary(library_); library_ = NULL; } } private: + FilePath path_; base::NativeLibrary library_; NP_ShutdownFunc NP_Shutdown_; DISALLOW_COPY_AND_ASSIGN(FreePluginLibraryTask); @@ -277,7 +293,8 @@ void PluginLib::Unload() { if (defer_unload) { FreePluginLibraryTask* free_library_task = - new FreePluginLibraryTask(skip_unload_ ? NULL : library_, + new FreePluginLibraryTask(web_plugin_info_.path, + skip_unload_ ? NULL : library_, entry_points_.np_shutdown); LOG_IF(ERROR, PluginList::DebugPluginLoading()) << "Scheduling delayed unload for plugin " diff --git a/webkit/glue/plugins/plugin_list.cc b/webkit/glue/plugins/plugin_list.cc index 4b3ce27..84736cb 100644 --- a/webkit/glue/plugins/plugin_list.cc +++ b/webkit/glue/plugins/plugin_list.cc @@ -24,19 +24,12 @@ namespace NPAPI { base::LazyInstance<PluginList> g_singleton(base::LINKER_INITIALIZED); -static LoadPluginsFromDiskHookFunc g_load_plugins_hook; - // static PluginList* PluginList::Singleton() { return g_singleton.Pointer(); } // static -void PluginList::SetPluginLoadHook(LoadPluginsFromDiskHookFunc hook) { - g_load_plugins_hook = hook; -} - -// static bool PluginList::DebugPluginLoading() { return CommandLine::ForCurrentProcess()->HasSwitch( switches::kDebugPluginLoading); @@ -196,9 +189,6 @@ void PluginList::LoadPlugins(bool refresh) { internal_plugins = internal_plugins_; } - if (g_load_plugins_hook) - g_load_plugins_hook(); - std::vector<WebPluginInfo> new_plugins; std::set<FilePath> visited_plugins; diff --git a/webkit/glue/plugins/plugin_list.h b/webkit/glue/plugins/plugin_list.h index 25b903b..101e6b7 100644 --- a/webkit/glue/plugins/plugin_list.h +++ b/webkit/glue/plugins/plugin_list.h @@ -63,8 +63,6 @@ struct PluginVersionInfo { PluginEntryPoints entry_points; }; -typedef void (*LoadPluginsFromDiskHookFunc)(); - // The PluginList is responsible for loading our NPAPI based plugins. It does // so in whatever manner is appropriate for the platform. On Windows, it loads // plugins from a known directory by looking for DLLs which start with "NP", @@ -78,9 +76,6 @@ class PluginList { // Gets the one instance of the PluginList. static PluginList* Singleton(); - // Set a hook that is called whenever we load plugins from the disk. - static void SetPluginLoadHook(LoadPluginsFromDiskHookFunc hook); - // Returns true if we're in debug-plugin-loading mode. This is controlled // by a command line switch. static bool DebugPluginLoading(); diff --git a/webkit/glue/plugins/plugin_list_posix.cc b/webkit/glue/plugins/plugin_list_posix.cc index 682381c..654c0c5 100644 --- a/webkit/glue/plugins/plugin_list_posix.cc +++ b/webkit/glue/plugins/plugin_list_posix.cc @@ -55,7 +55,7 @@ bool IsBlacklistedBySha1sum(const FilePath& path) { std::string sha1 = base::SHA1HashString(file_content); std::string sha1_readable; for (size_t j = 0; j < sha1.size(); j++) - StringAppendF(&sha1_readable, "%02x", sha1[j] & 0xFF); + base::StringAppendF(&sha1_readable, "%02x", sha1[j] & 0xFF); if (bad_entries[i].sha1 == sha1_readable) return true; } diff --git a/webkit/glue/simple_webmimeregistry_impl.h b/webkit/glue/simple_webmimeregistry_impl.h index 0056de0..f4f4d74 100644 --- a/webkit/glue/simple_webmimeregistry_impl.h +++ b/webkit/glue/simple_webmimeregistry_impl.h @@ -11,6 +11,9 @@ namespace webkit_glue { class SimpleWebMimeRegistryImpl : public WebKit::WebMimeRegistry { public: + SimpleWebMimeRegistryImpl() {} + virtual ~SimpleWebMimeRegistryImpl() {} + // WebMimeRegistry methods: virtual WebKit::WebMimeRegistry::SupportsType supportsMIMEType( const WebKit::WebString&); diff --git a/webkit/glue/user_agent.cc b/webkit/glue/user_agent.cc index 2babb49..4867c27 100644 --- a/webkit/glue/user_agent.cc +++ b/webkit/glue/user_agent.cc @@ -52,7 +52,7 @@ std::string BuildOSCpuInfo() { } #endif - StringAppendF( + base::StringAppendF( &os_cpu, #if defined(OS_WIN) "Windows NT %d.%d", @@ -102,7 +102,7 @@ void BuildUserAgent(bool mimic_windows, std::string* result) { std::string product = GetProductVersion(); // Derived from Safari's UA string. - StringAppendF( + base::StringAppendF( result, "Mozilla/5.0 (%s; %c; %s; %s) AppleWebKit/%d.%d" " (KHTML, like Gecko) %s Safari/%d.%d", diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc index c7a7d10..67b61ba 100644 --- a/webkit/glue/webkit_glue.cc +++ b/webkit/glue/webkit_glue.cc @@ -157,11 +157,11 @@ std::wstring DumpFrameScrollPosition(WebFrame* web_frame, bool recursive) { if (offset.width() > 0 || offset.height() > 0) { if (web_frame->parent()) { - StringAppendF(&result, L"frame '%ls' ", UTF16ToWide( + base::StringAppendF(&result, L"frame '%ls' ", UTF16ToWide( web_frame->name()).c_str()); } - StringAppendF(&result, L"scrolled to %d,%d\n", - offset.width(), offset.height()); + base::StringAppendF(&result, L"scrolled to %d,%d\n", + offset.width(), offset.height()); } if (recursive) { diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi index 99fb8b8..8ed3e8b 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -147,6 +147,7 @@ '<(DEPTH)/base/base.gyp:base_i18n', '<(DEPTH)/gpu/gpu.gyp:gles2_implementation', '<(DEPTH)/net/net.gyp:net', + '<(DEPTH)/ppapi/ppapi.gyp:ppapi_proxy', '<(DEPTH)/printing/printing.gyp:printing', '<(DEPTH)/skia/skia.gyp:skia', '<(DEPTH)/third_party/icu/icu.gyp:icui18n', diff --git a/webkit/glue/webmediaplayer_impl.cc b/webkit/glue/webmediaplayer_impl.cc index 919cf2e..bbf6172 100644 --- a/webkit/glue/webmediaplayer_impl.cc +++ b/webkit/glue/webmediaplayer_impl.cc @@ -11,6 +11,7 @@ #include "media/base/limits.h" #include "media/base/media_format.h" #include "media/base/media_switches.h" +#include "media/base/pipeline_impl.h" #include "media/base/video_frame.h" #include "media/filters/ffmpeg_audio_decoder.h" #include "media/filters/ffmpeg_demuxer.h" @@ -259,12 +260,13 @@ WebMediaPlayerImpl::WebMediaPlayerImpl( proxy_->SetVideoRenderer(web_video_renderer); // Set our pipeline callbacks. - pipeline_->SetPipelineEndedCallback(NewCallback(proxy_.get(), - &WebMediaPlayerImpl::Proxy::PipelineEndedCallback)); - pipeline_->SetPipelineErrorCallback(NewCallback(proxy_.get(), - &WebMediaPlayerImpl::Proxy::PipelineErrorCallback)); - pipeline_->SetNetworkEventCallback(NewCallback(proxy_.get(), - &WebMediaPlayerImpl::Proxy::NetworkEventCallback)); + pipeline_->Init( + NewCallback(proxy_.get(), + &WebMediaPlayerImpl::Proxy::PipelineEndedCallback), + NewCallback(proxy_.get(), + &WebMediaPlayerImpl::Proxy::PipelineErrorCallback), + NewCallback(proxy_.get(), + &WebMediaPlayerImpl::Proxy::NetworkEventCallback)); // A simple data source that keeps all data in memory. scoped_refptr<SimpleDataSource> simple_data_source( @@ -276,18 +278,18 @@ WebMediaPlayerImpl::WebMediaPlayerImpl( proxy_->SetDataSource(buffered_data_source); if (use_simple_data_source) { - filter_collection_->AddFilter(simple_data_source); - filter_collection_->AddFilter(buffered_data_source); + filter_collection_->AddDataSource(simple_data_source); + filter_collection_->AddDataSource(buffered_data_source); } else { - filter_collection_->AddFilter(buffered_data_source); - filter_collection_->AddFilter(simple_data_source); + filter_collection_->AddDataSource(buffered_data_source); + filter_collection_->AddDataSource(simple_data_source); } // Add in the default filter factories. - filter_collection_->AddFilter(new media::FFmpegDemuxer()); - filter_collection_->AddFilter(new media::FFmpegAudioDecoder()); - filter_collection_->AddFilter(new media::FFmpegVideoDecoder(NULL)); - filter_collection_->AddFilter(new media::NullAudioRenderer()); + filter_collection_->AddDemuxer(new media::FFmpegDemuxer()); + filter_collection_->AddAudioDecoder(new media::FFmpegAudioDecoder()); + filter_collection_->AddVideoDecoder(new media::FFmpegVideoDecoder(NULL)); + filter_collection_->AddAudioRenderer(new media::NullAudioRenderer()); } WebMediaPlayerImpl::~WebMediaPlayerImpl() { diff --git a/webkit/glue/webmediaplayer_impl.h b/webkit/glue/webmediaplayer_impl.h index 23f4148..9361020 100644 --- a/webkit/glue/webmediaplayer_impl.h +++ b/webkit/glue/webmediaplayer_impl.h @@ -57,11 +57,12 @@ #include "base/message_loop.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" +#include "base/thread.h" #include "base/waitable_event.h" #include "gfx/rect.h" #include "gfx/size.h" #include "media/base/filters.h" -#include "media/base/pipeline_impl.h" +#include "media/base/pipeline.h" #include "skia/ext/platform_canvas.h" #include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayer.h" #include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayerClient.h" @@ -283,7 +284,7 @@ class WebMediaPlayerImpl : public WebKit::WebMediaPlayer, scoped_ptr<media::MediaFilterCollection> filter_collection_; // The actual pipeline and the thread it runs on. - scoped_refptr<media::PipelineImpl> pipeline_; + scoped_refptr<media::Pipeline> pipeline_; base::Thread pipeline_thread_; // Playback state. diff --git a/webkit/glue/webpreferences.cc b/webkit/glue/webpreferences.cc index ecb2c38..afd41cf 100644 --- a/webkit/glue/webpreferences.cc +++ b/webkit/glue/webpreferences.cc @@ -29,7 +29,7 @@ WebPreferences::WebPreferences() fantasy_font_family(), // Not sure what to use on Windows. default_font_size(16), default_fixed_font_size(13), - minimum_font_size(1), + minimum_font_size(0), minimum_logical_font_size(6), default_encoding("ISO-8859-1"), javascript_enabled(true), |