| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_RENDERER_GUEST_VIEW_EXTENSIONS_GUEST_VIEW_CONTAINER_H_ | 5 #ifndef EXTENSIONS_RENDERER_GUEST_VIEW_EXTENSIONS_GUEST_VIEW_CONTAINER_H_ |
| 6 #define EXTENSIONS_RENDERER_GUEST_VIEW_EXTENSIONS_GUEST_VIEW_CONTAINER_H_ | 6 #define EXTENSIONS_RENDERER_GUEST_VIEW_EXTENSIONS_GUEST_VIEW_CONTAINER_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 | 9 |
| 10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "extensions/renderer/guest_view/guest_view_container.h" | 13 #include "extensions/renderer/guest_view/guest_view_container.h" |
| 14 #include "extensions/renderer/scoped_persistent.h" | 14 #include "v8/include/v8.h" |
| 15 | 15 |
| 16 namespace gfx { | 16 namespace gfx { |
| 17 class Size; | 17 class Size; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace extensions { | 20 namespace extensions { |
| 21 | 21 |
| 22 class ExtensionsGuestViewContainer : public GuestViewContainer { | 22 class ExtensionsGuestViewContainer : public GuestViewContainer { |
| 23 public: | 23 public: |
| 24 | 24 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 35 GuestViewContainer* container() const { return container_; } | 35 GuestViewContainer* container() const { return container_; } |
| 36 | 36 |
| 37 bool HasCallback() const; | 37 bool HasCallback() const; |
| 38 | 38 |
| 39 v8::Handle<v8::Function> GetCallback() const; | 39 v8::Handle<v8::Function> GetCallback() const; |
| 40 | 40 |
| 41 v8::Isolate* isolate() const { return isolate_; } | 41 v8::Isolate* isolate() const { return isolate_; } |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 GuestViewContainer* container_; | 44 GuestViewContainer* container_; |
| 45 ScopedPersistent<v8::Function> callback_; | 45 v8::UniquePersistent<v8::Function> callback_; |
| 46 v8::Isolate* const isolate_; | 46 v8::Isolate* const isolate_; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 // This class represents an AttachGuest request from Javascript. It includes | 49 // This class represents an AttachGuest request from Javascript. It includes |
| 50 // the input parameters and the callback function. The Attach operation may | 50 // the input parameters and the callback function. The Attach operation may |
| 51 // not execute immediately, if the container is not ready or if there are | 51 // not execute immediately, if the container is not ready or if there are |
| 52 // other attach operations in flight. | 52 // other attach operations in flight. |
| 53 class AttachRequest : public Request { | 53 class AttachRequest : public Request { |
| 54 public: | 54 public: |
| 55 AttachRequest(GuestViewContainer* container, | 55 AttachRequest(GuestViewContainer* container, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 const gfx::Size& new_size); | 103 const gfx::Size& new_size); |
| 104 void EnqueueRequest(linked_ptr<Request> request); | 104 void EnqueueRequest(linked_ptr<Request> request); |
| 105 void PerformPendingRequest(); | 105 void PerformPendingRequest(); |
| 106 void HandlePendingResponseCallback(const IPC::Message& message); | 106 void HandlePendingResponseCallback(const IPC::Message& message); |
| 107 | 107 |
| 108 bool ready_; | 108 bool ready_; |
| 109 | 109 |
| 110 std::deque<linked_ptr<Request> > pending_requests_; | 110 std::deque<linked_ptr<Request> > pending_requests_; |
| 111 linked_ptr<Request> pending_response_; | 111 linked_ptr<Request> pending_response_; |
| 112 | 112 |
| 113 ScopedPersistent<v8::Function> destruction_callback_; | 113 v8::UniquePersistent<v8::Function> destruction_callback_; |
| 114 v8::Isolate* destruction_isolate_; | 114 v8::Isolate* destruction_isolate_; |
| 115 | 115 |
| 116 ScopedPersistent<v8::Function> element_resize_callback_; | 116 v8::UniquePersistent<v8::Function> element_resize_callback_; |
| 117 v8::Isolate* element_resize_isolate_; | 117 v8::Isolate* element_resize_isolate_; |
| 118 | 118 |
| 119 // Weak pointer factory used for calling the element resize callback. | 119 // Weak pointer factory used for calling the element resize callback. |
| 120 base::WeakPtrFactory<ExtensionsGuestViewContainer> weak_ptr_factory_; | 120 base::WeakPtrFactory<ExtensionsGuestViewContainer> weak_ptr_factory_; |
| 121 | 121 |
| 122 DISALLOW_COPY_AND_ASSIGN(ExtensionsGuestViewContainer); | 122 DISALLOW_COPY_AND_ASSIGN(ExtensionsGuestViewContainer); |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 } // namespace extensions | 125 } // namespace extensions |
| 126 | 126 |
| 127 #endif // EXTENSIONS_RENDERER_GUEST_VIEW_EXTENSIONS_GUEST_VIEW_CONTAINER_H_ | 127 #endif // EXTENSIONS_RENDERER_GUEST_VIEW_EXTENSIONS_GUEST_VIEW_CONTAINER_H_ |
| OLD | NEW |