| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CONTENT_RENDERER_PEPPER_RESOURCE_CONVERTER_H | 5 #ifndef CONTENT_RENDERER_PEPPER_RESOURCE_CONVERTER_H |
| 6 #define CONTENT_RENDERER_PEPPER_RESOURCE_CONVERTER_H | 6 #define CONTENT_RENDERER_PEPPER_RESOURCE_CONVERTER_H |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // PP_VARTYPE_RESOURCE. On success, writes the resulting value to |result| and | 57 // PP_VARTYPE_RESOURCE. On success, writes the resulting value to |result| and |
| 58 // returns true. If an error occurs, returns false. | 58 // returns true. If an error occurs, returns false. |
| 59 virtual bool ToV8Value(const PP_Var& var, | 59 virtual bool ToV8Value(const PP_Var& var, |
| 60 v8::Handle<v8::Context> context, | 60 v8::Handle<v8::Context> context, |
| 61 v8::Handle<v8::Value>* result) = 0; | 61 v8::Handle<v8::Value>* result) = 0; |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 class ResourceConverterImpl : public ResourceConverter { | 64 class ResourceConverterImpl : public ResourceConverter { |
| 65 public: | 65 public: |
| 66 explicit ResourceConverterImpl(PP_Instance instance); | 66 explicit ResourceConverterImpl(PP_Instance instance); |
| 67 virtual ~ResourceConverterImpl(); | 67 ~ResourceConverterImpl() override; |
| 68 | 68 |
| 69 // ResourceConverter overrides. | 69 // ResourceConverter overrides. |
| 70 virtual void Reset() override; | 70 void Reset() override; |
| 71 virtual bool NeedsFlush() override; | 71 bool NeedsFlush() override; |
| 72 virtual void Flush(const base::Callback<void(bool)>& callback) override; | 72 void Flush(const base::Callback<void(bool)>& callback) override; |
| 73 virtual bool FromV8Value(v8::Handle<v8::Object> val, | 73 bool FromV8Value(v8::Handle<v8::Object> val, |
| 74 v8::Handle<v8::Context> context, | 74 v8::Handle<v8::Context> context, |
| 75 PP_Var* result, | 75 PP_Var* result, |
| 76 bool* was_resource) override; | 76 bool* was_resource) override; |
| 77 virtual bool ToV8Value(const PP_Var& var, | 77 bool ToV8Value(const PP_Var& var, |
| 78 v8::Handle<v8::Context> context, | 78 v8::Handle<v8::Context> context, |
| 79 v8::Handle<v8::Value>* result) override; | 79 v8::Handle<v8::Value>* result) override; |
| 80 | 80 |
| 81 private: | 81 private: |
| 82 // Creates a resource var with the given |pending_renderer_id| and | 82 // Creates a resource var with the given |pending_renderer_id| and |
| 83 // |create_message| to be sent to the plugin. | 83 // |create_message| to be sent to the plugin. |
| 84 scoped_refptr<HostResourceVar> CreateResourceVar( | 84 scoped_refptr<HostResourceVar> CreateResourceVar( |
| 85 int pending_renderer_id, | 85 int pending_renderer_id, |
| 86 const IPC::Message& create_message); | 86 const IPC::Message& create_message); |
| 87 // Creates a resource var with the given |pending_renderer_id| and | 87 // Creates a resource var with the given |pending_renderer_id| and |
| 88 // |create_message| to be sent to the plugin. Also sends | 88 // |create_message| to be sent to the plugin. Also sends |
| 89 // |browser_host_create_message| to the browser, and asynchronously stores the | 89 // |browser_host_create_message| to the browser, and asynchronously stores the |
| (...skipping 11 matching lines...) Expand all Loading... |
| 101 // conveniently passed to |CreateBrowserResourceHosts|. | 101 // conveniently passed to |CreateBrowserResourceHosts|. |
| 102 std::vector<IPC::Message> browser_host_create_messages_; | 102 std::vector<IPC::Message> browser_host_create_messages_; |
| 103 // A list of the resource vars associated with browser hosts. | 103 // A list of the resource vars associated with browser hosts. |
| 104 std::vector<scoped_refptr<HostResourceVar> > browser_vars_; | 104 std::vector<scoped_refptr<HostResourceVar> > browser_vars_; |
| 105 | 105 |
| 106 DISALLOW_COPY_AND_ASSIGN(ResourceConverterImpl); | 106 DISALLOW_COPY_AND_ASSIGN(ResourceConverterImpl); |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 } // namespace content | 109 } // namespace content |
| 110 #endif // CONTENT_RENDERER_PEPPER_RESOURCE_CONVERTER_H | 110 #endif // CONTENT_RENDERER_PEPPER_RESOURCE_CONVERTER_H |
| OLD | NEW |