Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1359)

Unified Diff: content/public/browser/navigator_connect_context.h

Issue 861373002: Refactor navigator.connect code to make it more flexible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/public/browser/navigator_connect_context.h
diff --git a/content/renderer/gpu/queue_message_swap_promise.h b/content/public/browser/navigator_connect_context.h
similarity index 22%
copy from content/renderer/gpu/queue_message_swap_promise.h
copy to content/public/browser/navigator_connect_context.h
index 245323e320f4b478ad1bf084cbc90d1acc0e06e5..083892b0303eb6292f3532aa7584c2fb8d2d337b 100644
--- a/content/renderer/gpu/queue_message_swap_promise.h
+++ b/content/public/browser/navigator_connect_context.h
@@ -2,46 +2,35 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_RENDERER_QUEUE_MESSAGE_SWAP_PROMISE_H_
-#define CONTENT_RENDERER_QUEUE_MESSAGE_SWAP_PROMISE_H_
+#ifndef CONTENT_PUBLIC_BROWSER_NAVIGATOR_CONNECT_CONTEXT_H_
+#define CONTENT_PUBLIC_BROWSER_NAVIGATOR_CONNECT_CONTEXT_H_
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
-#include "cc/base/swap_promise.h"
-
-namespace IPC {
-class SyncMessageFilter;
-}
namespace content {
-class FrameSwapMessageQueue;
+class NavigatorConnectServiceFactory;
-class QueueMessageSwapPromise : public cc::SwapPromise {
+// Use this class to register additional navigator.connect service factories.
+// One instance of this class exists per StoragePartition.
+// TODO(mek): Add API to this class so NavigatorConnectService implementations
+// can send messages back to the client.
+// TODO(mek): Add API so services can close a connection.
+class NavigatorConnectContext
+ : public base::RefCountedThreadSafe<NavigatorConnectContext> {
public:
- QueueMessageSwapPromise(scoped_refptr<IPC::SyncMessageFilter> message_sender,
- scoped_refptr<FrameSwapMessageQueue> message_queue,
- int source_frame_number);
-
- ~QueueMessageSwapPromise() override;
-
- void DidSwap(cc::CompositorFrameMetadata* metadata) override;
-
- void DidNotSwap(DidNotSwapReason reason) override;
-
- int64 TraceId() const override;
-
- private:
- void PromiseCompleted();
-
- scoped_refptr<IPC::SyncMessageFilter> message_sender_;
- scoped_refptr<content::FrameSwapMessageQueue> message_queue_;
- int source_frame_number_;
-#if DCHECK_IS_ON()
- bool completed_;
-#endif
+ // Register a service factory. The most recently added factory that claims to
+ // handle a URL will be used to handle a connection request for that URL.
+ virtual void AddFactory(
+ scoped_ptr<NavigatorConnectServiceFactory> factory) = 0;
+
+ protected:
+ friend class base::RefCountedThreadSafe<NavigatorConnectContext>;
+ NavigatorConnectContext() {}
+ virtual ~NavigatorConnectContext() {}
};
} // namespace content
-#endif // CONTENT_RENDERER_QUEUE_MESSAGE_SWAP_PROMISE_H_
+#endif // CONTENT_PUBLIC_BROWSER_NAVIGATOR_CONNECT_CONTEXT_H_
« no previous file with comments | « content/public/browser/content_browser_client.h ('k') | content/public/browser/navigator_connect_service_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698