Chromium Code Reviews| Index: chrome/renderer/plugins/plugin_preroller.h |
| diff --git a/chrome/renderer/plugins/plugin_preroller.h b/chrome/renderer/plugins/plugin_preroller.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e1a7515b2af3610115b70093ceb3815547d4dd5a |
| --- /dev/null |
| +++ b/chrome/renderer/plugins/plugin_preroller.h |
| @@ -0,0 +1,63 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_RENDERER_PLUGINS_PLUGIN_PREROLLER_H_ |
| +#define CHROME_RENDERER_PLUGINS_PLUGIN_PREROLLER_H_ |
| + |
| +#include "base/macros.h" |
| +#include "content/public/common/webplugininfo.h" |
| +#include "content/public/renderer/plugin_instance_throttler.h" |
| +#include "third_party/WebKit/public/web/WebPluginParams.h" |
| + |
| +namespace blink { |
| +class WebPlugin; |
| +class WebLocalFrame; |
| +} |
| + |
| +class SkBitmap; |
| + |
| +// This class manages a plugin briefly for the purposes of keyframe extraction. |
| +// Once a keyframe has been extracted, this class will replace it with a |
| +// ChromePluginPlaceholder. The actual plugin will continue to live in a |
| +// throttled state. This class manages its own lifetime. |
| +class PluginPreroller : public content::PluginInstanceThrottler::Observer { |
| + public: |
| + // Does not take ownership of either |plugin| or |throttler|. |
| + PluginPreroller(content::RenderFrame* render_frame, |
| + blink::WebLocalFrame* frame, |
| + const blink::WebPluginParams& params, |
| + const content::WebPluginInfo& info, |
| + const std::string& identifier, |
| + const base::string16& name, |
| + const base::string16& message, |
| + blink::WebPlugin* plugin, |
| + content::PluginInstanceThrottler* throttler); |
| + |
| + virtual ~PluginPreroller(); |
| + |
| + blink::WebPlugin* plugin() { return plugin_; } |
| + |
| + private: |
| + // content::PluginInstanceThrottler::Observer methods: |
| + void OnKeyframeExtracted(const SkBitmap* bitmap) override; |
| + void OnThrottleStateChange() override; |
| + void OnThrottlerDestroyed() override; |
| + |
| + content::RenderFrame* render_frame_; |
| + blink::WebLocalFrame* frame_; |
| + blink::WebPluginParams params_; |
| + content::WebPluginInfo info_; |
| + std::string identifier_; |
| + base::string16 name_; |
| + base::string16 message_; |
| + |
| + blink::WebPlugin* plugin_; |
| + content::PluginInstanceThrottler* throttler_; |
| + |
| + std::string keyframe_data_url_; |
|
Bernhard Bauer
2015/01/30 14:12:56
Any reason you're not storing this directly as a G
tommycli
2015/01/30 17:02:40
Done.
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(PluginPreroller); |
| +}; |
| + |
| +#endif // CHROME_RENDERER_PLUGINS_PLUGIN_PREROLLER_H_ |