Closed GoogleCodeExporter closed 9 years ago
This is the patch to support download item pause & resume. How do I commit to
trunk?
Original comment by sheny...@gmail.com
on 1 Jan 2015 at 3:18
Attachments:
Here is what I test code on client_handler.cc for cefclient program.
========================
diff --git a/tests/cefclient/client_handler.cpp
b/tests/cefclient/client_handler.cpp
index 92de2a1..4caee66 100644
--- a/tests/cefclient/client_handler.cpp
+++ b/tests/cefclient/client_handler.cpp
@@ -263,6 +263,22 @@ void ClientHandler::OnDownloadUpdated(
CefRefPtr<CefDownloadItemCallback> callback) {
CEF_REQUIRE_UI_THREAD();
+ static bool pause = false;
+ static int count = 0;
+
+ fprintf(stderr, "received %ld, is_paused=%d count=%d\n",
download_item->GetReceivedBytes(), pause, count);
+ if (!pause && !count && download_item->GetReceivedBytes() > 2000000) {
+ pause = true;
+ count = 0;
+ callback->Pause();
+ }
+ if (pause == true) {
+ count ++;
+ }
+ if (count > 30 && pause) {
+ callback->Resume();
+ pause = false;
+ }
if (download_item->IsComplete()) {
SetLastDownloadFile(download_item->GetFullPath());
SendNotification(NOTIFY_DOWNLOAD_COMPLETE);
Original comment by sheny...@gmail.com
on 1 Jan 2015 at 3:19
replace origin patch without update code date.
Original comment by sheny...@gmail.com
on 1 Jan 2015 at 3:37
Attachments:
@#3: Thanks for the patch. Some comments:
1. Line 29:
virtual void Cancel() =0;
+ ///
+ // Call to pause the download.
+ ///
+ /*--cef()--*/
+ virtual void Pause() =0;
+ ///
+ // Call to resume the download.
+ ///
+ /*--cef()--*/
+ virtual void Resume() =0;
Add a space between methods.
2. Don't include changes to generated libcef_dll files in your patch file.
3. Use `git diff --no-prefix` to create patch files (this leaves off the a/ b/
prefixes on the file paths).
You don't need to update the patch file, I'll fix #1 before I commit it.
Original comment by magreenb...@gmail.com
on 5 Jan 2015 at 11:11
@#3: Added in trunk revision 1966.
Original comment by magreenb...@gmail.com
on 12 Jan 2015 at 7:47
Original issue reported on code.google.com by
magreenb...@gmail.com
on 7 Nov 2014 at 4:16