Chromium Code Reviews| Index: webkit/plugins/ppapi/resource_helper.h |
| diff --git a/webkit/plugins/ppapi/resource_helper.h b/webkit/plugins/ppapi/resource_helper.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d958889e3afafb5faa193fb163a91e2e440722d4 |
| --- /dev/null |
| +++ b/webkit/plugins/ppapi/resource_helper.h |
| @@ -0,0 +1,48 @@ |
| +// Copyright (c) 2011 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 WEBKIT_PLUGINS_PPAPI_RESOURCE_HELPER_H_ |
| +#define WEBKIT_PLUGINS_PPAPI_RESOURCE_HELPER_H_ |
| + |
| +#include "base/basictypes.h" |
| +#include "ppapi/c/pp_resource.h" |
| + |
| +namespace ppapi { |
| +class Resource; |
| +} |
| + |
| +namespace webkit { |
| +namespace ppapi { |
| + |
| +class PluginInstance; |
| +class PluginModule; |
| +class PluginDelegate; |
| + |
| +// Helper functions for Resoruce implementations. |
| +// |
| +// This is specifically not designed to be a base class that derives from |
| +// ppapi::Resource to avoid diamond inheritance if most of a resource class |
| +// is implemented in the shared_impl (to share code with the proxy). |
| +class ResourceHelper { |
| + public: |
| + // Returns the instance implementation object for the given resource, or NULL |
| + // if the resource has outlived its instance. |
| + static PluginInstance* GetPluginInstance(const ::ppapi::Resource* resource); |
| + |
| + // Returns the module for the given resource, or NULL if the resource has |
| + // outlived its instance. |
|
viettrungluu
2011/08/23 17:28:13
I -- or, better, you -- should go back and check t
brettw
2011/08/23 23:16:21
Most of the places I didn't check because I think
brettw
2011/08/23 23:16:51
In the most recent patch I audited all callers and
|
| + static PluginModule* GetPluginModule(const ::ppapi::Resource* resource); |
| + |
| + // Returns the plugin delegate for the given resource, or NULL if the |
| + // resource has outlived its instance. |
| + static PluginDelegate* GetPluginDelegate(const ::ppapi::Resource* resource); |
|
viettrungluu
2011/08/23 17:28:13
"
|
| + |
| + private: |
| + DISALLOW_IMPLICIT_CONSTRUCTORS(ResourceHelper); |
| +}; |
| + |
| +} // namespace ppapi |
| +} // namespace webkit |
| + |
| +#endif // WEBKIT_PLUGINS_PPAPI_RESOURCE_IMPL_HELPER_H_ |