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

Side by Side Diff: components/translate/core/browser/translate_script.h

Issue 2251273002: pass script fetch start / end time to Transalte Element to implement real time latency monitoring (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_SCRIPT_H_ 5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_SCRIPT_H_
6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_SCRIPT_H_ 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_SCRIPT_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 // The callback when the script is fetched or a server error occured. 74 // The callback when the script is fetched or a server error occured.
75 void OnScriptFetchComplete(int id, bool success, const std::string& data); 75 void OnScriptFetchComplete(int id, bool success, const std::string& data);
76 76
77 // URL fetcher to fetch the translate script. 77 // URL fetcher to fetch the translate script.
78 std::unique_ptr<TranslateURLFetcher> fetcher_; 78 std::unique_ptr<TranslateURLFetcher> fetcher_;
79 79
80 // The JS injected in the page to do the translation. 80 // The JS injected in the page to do the translation.
81 std::string data_; 81 std::string data_;
82 82
83 // The starting time of fetching the translate script.
84 // Number of milliseconds since the epoch.
85 double script_fetch_start_time_;
86
83 // Delay after which the translate script is fetched again from the translate 87 // Delay after which the translate script is fetched again from the translate
84 // server. 88 // server.
85 base::TimeDelta expiration_delay_; 89 base::TimeDelta expiration_delay_;
86 90
87 // The callbacks called when the server sends a response. 91 // The callbacks called when the server sends a response.
88 typedef std::vector<RequestCallback> RequestCallbackList; 92 typedef std::vector<RequestCallback> RequestCallbackList;
89 RequestCallbackList callback_list_; 93 RequestCallbackList callback_list_;
90 94
91 base::WeakPtrFactory<TranslateScript> weak_method_factory_; 95 base::WeakPtrFactory<TranslateScript> weak_method_factory_;
92 96
93 DISALLOW_COPY_AND_ASSIGN(TranslateScript); 97 DISALLOW_COPY_AND_ASSIGN(TranslateScript);
94 }; 98 };
95 99
96 } // namespace translate 100 } // namespace translate
97 101
98 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_SCRIPT_H_ 102 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_SCRIPT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698