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

Side by Side Diff: components/translate/content/renderer/data_file_renderer_cld_data_provider.h

Issue 2034413003: Delete the non-static CLD data source logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase to latest master Created 4 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
(Empty)
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
3 // found in the LICENSE file.
4
5 // NOT DEAD CODE!
6 // This code isn't dead, even if it isn't currently being used. Please refer to:
7 // https://www.chromium.org/developers/how-tos/compact-language-detector-cld-dat a-source-configuration
8
9 #ifndef COMPONENTS_TRANSLATE_CONTENT_RENDERER_DATA_FILE_RENDERER_CLD_DATA_PROVID ER_H_
10 #define COMPONENTS_TRANSLATE_CONTENT_RENDERER_DATA_FILE_RENDERER_CLD_DATA_PROVID ER_H_
11
12 #include <stdint.h>
13
14 #include "base/files/file.h"
15 #include "base/macros.h"
16 #include "components/translate/content/renderer/renderer_cld_data_provider.h"
17 #include "ipc/ipc_platform_file.h"
18
19 namespace content {
20 class RenderFrameObserver;
21 }
22
23 namespace translate {
24
25 class DataFileRendererCldDataProvider : public RendererCldDataProvider {
26 public:
27 explicit DataFileRendererCldDataProvider(content::RenderFrameObserver*);
28 ~DataFileRendererCldDataProvider() override;
29
30 // Load the CLD data from the specified file, starting at the specified byte
31 // offset and having the specified length (also in bytes). Nominally, the
32 // implementation will mmap the file in read-only mode and hand the data off
33 // to CLD2::loadDataFromRawAddress(...). See the module
34 // third_party/cld_2/src/internal/compact_lang_det.h for more information on
35 // the dynamic data loading process.
36 void LoadCldData(base::File file,
37 const uint64_t data_offset,
38 const uint64_t data_length);
39
40 // RendererCldDataProvider implementations:
41 bool OnMessageReceived(const IPC::Message&) override;
42 void SendCldDataRequest() override;
43 void SetCldAvailableCallback(base::Callback<void(void)>) override;
44 bool IsCldDataAvailable() override;
45
46 private:
47 void OnCldDataAvailable(const IPC::PlatformFileForTransit ipc_file_handle,
48 const uint64_t data_offset,
49 const uint64_t data_length);
50 content::RenderFrameObserver* render_frame_observer_;
51 base::Callback<void(void)> cld_available_callback_;
52
53 DISALLOW_COPY_AND_ASSIGN(DataFileRendererCldDataProvider);
54 };
55
56 } // namespace translate
57
58 #endif // COMPONENTS_TRANSLATE_CONTENT_RENDERER_DATA_FILE_RENDERER_CLD_DATA_PRO VIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698