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

Side by Side Diff: content/browser/webui/i18n_source_stream.h

Issue 2601313002: [MD settings] stream i18n replacement without large accumulation buffer (Closed)
Patch Set: nits Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/webui/i18n_source_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_BROWSER_WEBUI_I18N_SOURCE_STREAM_H_ 5 #ifndef CONTENT_BROWSER_WEBUI_I18N_SOURCE_STREAM_H_
6 #define CONTENT_BROWSER_WEBUI_I18N_SOURCE_STREAM_H_ 6 #define CONTENT_BROWSER_WEBUI_I18N_SOURCE_STREAM_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 22 matching lines...) Expand all
33 33
34 // SourceStream implementation. 34 // SourceStream implementation.
35 std::string GetTypeAsString() const override; 35 std::string GetTypeAsString() const override;
36 int FilterData(net::IOBuffer* output_buffer, 36 int FilterData(net::IOBuffer* output_buffer,
37 int output_buffer_size, 37 int output_buffer_size,
38 net::IOBuffer* input_buffer, 38 net::IOBuffer* input_buffer,
39 int input_buffer_size, 39 int input_buffer_size,
40 int* consumed_bytes, 40 int* consumed_bytes,
41 bool upstream_end_reached) override; 41 bool upstream_end_reached) override;
42 42
43 // Accumulated from upstream. 43 // Keep split $i18n tags (wait for the whole tag). This is expected to vary
44 // in size from 0 to a few KB and should never be larger than the input file
45 // (in the worst case).
44 std::string input_; 46 std::string input_;
45 47
46 // To send downstream. 48 // Keep excess that didn't fit in the output buffer. This is expected to vary
49 // in size from 0 to a few KB and should never get much larger than the input
50 // file (in the worst case).
47 std::string output_; 51 std::string output_;
48 52
49 // How much of the |output_| has been sent.
50 size_t drain_offset_;
51
52 // A map of i18n replacement keys and translations. 53 // A map of i18n replacement keys and translations.
53 const ui::TemplateReplacements* replacements_; // weak 54 const ui::TemplateReplacements* replacements_; // weak
54 55
55 DISALLOW_COPY_AND_ASSIGN(I18nSourceStream); 56 DISALLOW_COPY_AND_ASSIGN(I18nSourceStream);
56 }; 57 };
57 58
58 } // namespace content 59 } // namespace content
59 60
60 #endif // CONTENT_BROWSER_WEBUI_I18N_SOURCE_STREAM_H_ 61 #endif // CONTENT_BROWSER_WEBUI_I18N_SOURCE_STREAM_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/webui/i18n_source_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698