| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_MOJO_BLINK_INTERFACE_PROVIDER_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MOJO_BLINK_INTERFACE_PROVIDER_IMPL_H_ |
| 6 #define CONTENT_RENDERER_MOJO_BLINK_INTERFACE_PROVIDER_IMPL_H_ | 6 #define CONTENT_RENDERER_MOJO_BLINK_INTERFACE_PROVIDER_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "mojo/public/cpp/system/message_pipe.h" | 11 #include "mojo/public/cpp/system/message_pipe.h" |
| 12 #include "third_party/WebKit/public/platform/InterfaceProvider.h" | 12 #include "third_party/WebKit/public/platform/InterfaceProvider.h" |
| 13 | 13 |
| 14 namespace base { | 14 namespace base { |
| 15 class SingleThreadTaskRunner; | 15 class SingleThreadTaskRunner; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace service_manager { | 18 namespace service_manager { |
| 19 class Connector; |
| 19 class InterfaceProvider; | 20 class InterfaceProvider; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace content { | 23 namespace content { |
| 23 | 24 |
| 24 // An implementation of blink::InterfaceProvider that forwards to a | 25 // An implementation of blink::InterfaceProvider that forwards to a |
| 25 // service_manager::InterfaceProvider. | 26 // service_manager::InterfaceProvider. |
| 26 class BlinkInterfaceProviderImpl : public blink::InterfaceProvider { | 27 class BlinkInterfaceProviderImpl : public blink::InterfaceProvider { |
| 27 public: | 28 public: |
| 28 explicit BlinkInterfaceProviderImpl( | 29 explicit BlinkInterfaceProviderImpl( |
| 30 base::WeakPtr<service_manager::Connector> connector); |
| 31 explicit BlinkInterfaceProviderImpl( |
| 29 base::WeakPtr<service_manager::InterfaceProvider> remote_interfaces); | 32 base::WeakPtr<service_manager::InterfaceProvider> remote_interfaces); |
| 30 ~BlinkInterfaceProviderImpl(); | 33 ~BlinkInterfaceProviderImpl(); |
| 31 | 34 |
| 32 // blink::InterfaceProvider override. | 35 // blink::InterfaceProvider override. |
| 33 void getInterface(const char* name, | 36 void getInterface(const char* name, |
| 34 mojo::ScopedMessagePipeHandle handle) override; | 37 mojo::ScopedMessagePipeHandle handle) override; |
| 35 | 38 |
| 36 private: | 39 private: |
| 40 const base::WeakPtr<service_manager::Connector> connector_; |
| 37 const base::WeakPtr<service_manager::InterfaceProvider> remote_interfaces_; | 41 const base::WeakPtr<service_manager::InterfaceProvider> remote_interfaces_; |
| 38 | 42 |
| 39 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 43 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| 40 | 44 |
| 41 // Should only be accessed by Web Worker threads that are using the | 45 // Should only be accessed by Web Worker threads that are using the |
| 42 // blink::Platform-level interface provider. | 46 // blink::Platform-level interface provider. |
| 43 base::WeakPtr<BlinkInterfaceProviderImpl> weak_ptr_; | 47 base::WeakPtr<BlinkInterfaceProviderImpl> weak_ptr_; |
| 44 base::WeakPtrFactory<BlinkInterfaceProviderImpl> weak_ptr_factory_; | 48 base::WeakPtrFactory<BlinkInterfaceProviderImpl> weak_ptr_factory_; |
| 45 | 49 |
| 46 DISALLOW_COPY_AND_ASSIGN(BlinkInterfaceProviderImpl); | 50 DISALLOW_COPY_AND_ASSIGN(BlinkInterfaceProviderImpl); |
| 47 }; | 51 }; |
| 48 | 52 |
| 49 } // namespace content | 53 } // namespace content |
| 50 | 54 |
| 51 #endif // CONTENT_RENDERER_MOJO_BLINK_INTERFACE_PROVIDER_IMPL_H_ | 55 #endif // CONTENT_RENDERER_MOJO_BLINK_INTERFACE_PROVIDER_IMPL_H_ |
| OLD | NEW |