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

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

Issue 1164493008: Implement WebDataConsumerHandle::Reader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "content/common/content_export.h" 9 #include "content/common/content_export.h"
10 #include "mojo/common/handle_watcher.h" 10 #include "mojo/common/handle_watcher.h"
11 #include "third_party/WebKit/public/platform/WebDataConsumerHandle.h" 11 #include "third_party/WebKit/public/platform/WebDataConsumerHandle.h"
12 #include "third_party/mojo/src/mojo/public/cpp/system/data_pipe.h" 12 #include "third_party/mojo/src/mojo/public/cpp/system/data_pipe.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 class CONTENT_EXPORT WebDataConsumerHandleImpl final 16 class CONTENT_EXPORT WebDataConsumerHandleImpl final
17 : public NON_EXPORTED_BASE(blink::WebDataConsumerHandle) { 17 : public NON_EXPORTED_BASE(blink::WebDataConsumerHandle) {
18 typedef mojo::ScopedDataPipeConsumerHandle Handle; 18 typedef mojo::ScopedDataPipeConsumerHandle Handle;
19 class Context;
20
19 public: 21 public:
22 class CONTENT_EXPORT ReaderImpl final : public NON_EXPORTED_BASE(Reader) {
23 public:
24 ReaderImpl(scoped_refptr<Context> context, Client* client);
25 virtual ~ReaderImpl();
26 virtual Result read(void* data, size_t size, Flags flags, size_t* readSize);
27 virtual Result beginRead(const void** buffer,
28 Flags flags,
29 size_t* available);
30 virtual Result endRead(size_t readSize);
31
32 private:
33 Result HandleReadResult(MojoResult);
34 void StartWatching();
35 void OnHandleGotReadable(MojoResult);
36
37 scoped_refptr<Context> context_;
38 mojo::common::HandleWatcher handle_watcher_;
39 Client* client_;
40 };
41 scoped_ptr<Reader> ObtainReader(Client* client);
42
20 explicit WebDataConsumerHandleImpl(Handle handle); 43 explicit WebDataConsumerHandleImpl(Handle handle);
21 virtual ~WebDataConsumerHandleImpl(); 44 virtual ~WebDataConsumerHandleImpl();
22 45
23 virtual Result read(void* data, size_t size, Flags flags, size_t* readSize); 46 private:
24 virtual Result beginRead(const void** buffer, Flags flags, size_t* available); 47 virtual ReaderImpl* obtainReaderInternal(Client* client);
25 virtual Result endRead(size_t readSize);
26 virtual void registerClient(Client* client);
27 virtual void unregisterClient();
28 48
29 private: 49 scoped_refptr<Context> context_;
30 Result HandleReadResult(MojoResult);
31 void OnHandleGotReadable(MojoResult);
32
33 Handle handle_;
34 Client* client_;
35 mojo::common::HandleWatcher handle_watcher_;
36 }; 50 };
37 51
38 } // namespace content 52 } // namespace content
39 53
40 #endif // CONTENT_CHILD_WEB_DATA_CONSUMER_HANDLE_IMPL_H_ 54 #endif // CONTENT_CHILD_WEB_DATA_CONSUMER_HANDLE_IMPL_H_
OLDNEW
« no previous file with comments | « content/child/shared_memory_data_consumer_handle_unittest.cc ('k') | content/child/web_data_consumer_handle_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698