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

Side by Side Diff: content/child/web_data_consumer_handle_impl.h

Issue 2725133002: Mojo: Armed Watchers (Closed)
Patch Set: rebase Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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 CONTENT_CHILD_WEB_DATA_CONSUMER_HANDLE_IMPL_H_ 5 #ifndef CONTENT_CHILD_WEB_DATA_CONSUMER_HANDLE_IMPL_H_
6 #define CONTENT_CHILD_WEB_DATA_CONSUMER_HANDLE_IMPL_H_ 6 #define CONTENT_CHILD_WEB_DATA_CONSUMER_HANDLE_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "content/common/content_export.h" 12 #include "content/common/content_export.h"
13 #include "mojo/public/cpp/system/data_pipe.h" 13 #include "mojo/public/cpp/system/data_pipe.h"
14 #include "mojo/public/cpp/system/watcher.h" 14 #include "mojo/public/cpp/system/simple_watcher.h"
15 #include "third_party/WebKit/public/platform/WebDataConsumerHandle.h" 15 #include "third_party/WebKit/public/platform/WebDataConsumerHandle.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 class CONTENT_EXPORT WebDataConsumerHandleImpl final 19 class CONTENT_EXPORT WebDataConsumerHandleImpl final
20 : public NON_EXPORTED_BASE(blink::WebDataConsumerHandle) { 20 : public NON_EXPORTED_BASE(blink::WebDataConsumerHandle) {
21 typedef mojo::ScopedDataPipeConsumerHandle Handle; 21 typedef mojo::ScopedDataPipeConsumerHandle Handle;
22 class Context; 22 class Context;
23 23
24 public: 24 public:
25 class CONTENT_EXPORT ReaderImpl final : public NON_EXPORTED_BASE(Reader) { 25 class CONTENT_EXPORT ReaderImpl final : public NON_EXPORTED_BASE(Reader) {
26 public: 26 public:
27 ReaderImpl(scoped_refptr<Context> context, Client* client); 27 ReaderImpl(scoped_refptr<Context> context, Client* client);
28 ~ReaderImpl() override; 28 ~ReaderImpl() override;
29 Result read(void* data, 29 Result read(void* data,
30 size_t size, 30 size_t size,
31 Flags flags, 31 Flags flags,
32 size_t* readSize) override; 32 size_t* readSize) override;
33 Result beginRead(const void** buffer, 33 Result beginRead(const void** buffer,
34 Flags flags, 34 Flags flags,
35 size_t* available) override; 35 size_t* available) override;
36 Result endRead(size_t readSize) override; 36 Result endRead(size_t readSize) override;
37 37
38 private: 38 private:
39 Result HandleReadResult(MojoResult); 39 Result HandleReadResult(MojoResult);
40 void StartWatching(); 40 void StartWatching();
41 void OnHandleGotReadable(MojoResult); 41 void OnHandleGotReadable(MojoResult);
42 42
43 scoped_refptr<Context> context_; 43 scoped_refptr<Context> context_;
44 mojo::Watcher handle_watcher_; 44 mojo::SimpleWatcher handle_watcher_;
45 Client* client_; 45 Client* client_;
46 46
47 DISALLOW_COPY_AND_ASSIGN(ReaderImpl); 47 DISALLOW_COPY_AND_ASSIGN(ReaderImpl);
48 }; 48 };
49 std::unique_ptr<Reader> obtainReader(Client* client) override; 49 std::unique_ptr<Reader> obtainReader(Client* client) override;
50 50
51 explicit WebDataConsumerHandleImpl(Handle handle); 51 explicit WebDataConsumerHandleImpl(Handle handle);
52 ~WebDataConsumerHandleImpl() override; 52 ~WebDataConsumerHandleImpl() override;
53 53
54 private: 54 private:
55 const char* debugName() const override; 55 const char* debugName() const override;
56 56
57 scoped_refptr<Context> context_; 57 scoped_refptr<Context> context_;
58 58
59 DISALLOW_COPY_AND_ASSIGN(WebDataConsumerHandleImpl); 59 DISALLOW_COPY_AND_ASSIGN(WebDataConsumerHandleImpl);
60 }; 60 };
61 61
62 } // namespace content 62 } // namespace content
63 63
64 #endif // CONTENT_CHILD_WEB_DATA_CONSUMER_HANDLE_IMPL_H_ 64 #endif // CONTENT_CHILD_WEB_DATA_CONSUMER_HANDLE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698