|
|
Description[Android] Open up API in jni bridge to fetch images from tab
Enhanced bookmark feature requires the user to see the image immediately
when he bookmarks a page. By openning this API, the java side can now
call it when the user clicks star button.
BUG=454623
Committed: https://crrev.com/6a6dc80aab193de63e92ead8b97cf33a6e925fee
Cr-Commit-Position: refs/heads/master@{#315454}
Patch Set 1 #Patch Set 2 : add javadoc #
Total comments: 6
Patch Set 3 : #
Total comments: 4
Patch Set 4 : nits fixes #
Messages
Total messages: 22 (6 generated)
ianwen@chromium.org changed reviewers: + kkimlabs@chromium.org, tedchoc@chromium.org
Downstream CL: https://chrome-internal-review.googlesource.com/#/c/196255/
lgtm https://codereview.chromium.org/896093007/diff/20001/chrome/android/java/src/... File chrome/android/java/src/org/chromium/chrome/browser/EnhancedBookmarksBridge.java (right): https://codereview.chromium.org/896093007/diff/20001/chrome/android/java/src/... chrome/android/java/src/org/chromium/chrome/browser/EnhancedBookmarksBridge.java:252: public void fetchImageForTab(Tab tab) { I would pass WebContents here since I don't think you really need Tab at all.
https://codereview.chromium.org/896093007/diff/20001/chrome/android/java/src/... File chrome/android/java/src/org/chromium/chrome/browser/EnhancedBookmarksBridge.java (right): https://codereview.chromium.org/896093007/diff/20001/chrome/android/java/src/... chrome/android/java/src/org/chromium/chrome/browser/EnhancedBookmarksBridge.java:252: public void fetchImageForTab(Tab tab) { This will also update bookmark's metadata so the item should be bookmarked at the time it is fetched, or it's just leaking to the image storage. So I think it'd good to name the function so that it's clear at call-site. Random note: To me, BookmarkImageService class seemed unsafe. I'm not sure it considers various leaking scenarios. I'm not 100% sure, but for example, while fetching the image, if user deleted the bookmark, |BookmarkImageService::ProcessNewImage| will be called when the fetching is done. It immediately stores to the database by |PostTaskToStoreImage|, and try to update bookmark metadata later. If bookmark is not found, it just returns. Then isn't it that there is no bookmark but image saved to the database.
https://codereview.chromium.org/896093007/diff/20001/chrome/android/java/src/... File chrome/android/java/src/org/chromium/chrome/browser/EnhancedBookmarksBridge.java (right): https://codereview.chromium.org/896093007/diff/20001/chrome/android/java/src/... chrome/android/java/src/org/chromium/chrome/browser/EnhancedBookmarksBridge.java:252: public void fetchImageForTab(Tab tab) { On 2015/02/06 20:54:02, Kibeom Kim wrote: > This will also update bookmark's metadata so the item should be bookmarked at > the time it is fetched, or it's just leaking to the image storage. So I think > it'd good to name the function so that it's clear at call-site. > > > Random note: To me, BookmarkImageService class seemed unsafe. I'm not sure it > considers various leaking scenarios. I'm not 100% sure, but for example, while > fetching the image, if user deleted the bookmark, > |BookmarkImageService::ProcessNewImage| will be called when the fetching is > done. It immediately stores to the database by |PostTaskToStoreImage|, and try > to update bookmark metadata later. If bookmark is not found, it just returns. > Then isn't it that there is no bookmark but image saved to the database. Hmmm.. The scenario you mentioned is not specific to this function, right? If you call SalientImageForUrl(), and immediately after it you delete a bookmark, is it still going to be stored by later callbacks? I would file another bug for it and modify ProcessForImage() to add an additional check.
On 2015/02/06 22:48:44, Ian Wen wrote: > Hmmm.. The scenario you mentioned is not specific to this function, right? If > you call SalientImageForUrl(), and immediately after it you delete a bookmark, > is it still going to be stored by later callbacks? I would file another bug for > it and modify ProcessForImage() to add an additional check. Thanks for filing a bug. This is just one quick example though. There can be a lot of cases, for example, it should also consider sudden process kill at any given code state since it's dealing with local storage.
https://codereview.chromium.org/896093007/diff/20001/chrome/browser/enhanced_... File chrome/browser/enhanced_bookmarks/android/enhanced_bookmarks_bridge.cc (right): https://codereview.chromium.org/896093007/diff/20001/chrome/browser/enhanced_... chrome/browser/enhanced_bookmarks/android/enhanced_bookmarks_bridge.cc:118: } In addition to using WebContent, since this is parallel to BookmarkImageServiceAndroid::FinishSuccessfulPageLoadForTab . I think it's good to put there.
https://codereview.chromium.org/896093007/diff/20001/chrome/android/java/src/... File chrome/android/java/src/org/chromium/chrome/browser/EnhancedBookmarksBridge.java (right): https://codereview.chromium.org/896093007/diff/20001/chrome/android/java/src/... chrome/android/java/src/org/chromium/chrome/browser/EnhancedBookmarksBridge.java:252: public void fetchImageForTab(Tab tab) { On 2015/02/06 20:13:28, Ted C wrote: > I would pass WebContents here since I don't think you really need Tab at all. Done.
https://codereview.chromium.org/896093007/diff/20001/chrome/browser/enhanced_... File chrome/browser/enhanced_bookmarks/android/enhanced_bookmarks_bridge.cc (right): https://codereview.chromium.org/896093007/diff/20001/chrome/browser/enhanced_... chrome/browser/enhanced_bookmarks/android/enhanced_bookmarks_bridge.cc:118: } On 2015/02/09 21:30:34, Kibeom Kim wrote: > In addition to using WebContent, since this is parallel to > BookmarkImageServiceAndroid::FinishSuccessfulPageLoadForTab . I think it's good > to put there. discussed offline. It's just two lines, so let's just leave it.
The CQ bit was checked by ianwen@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/896093007/20001
The CQ bit was unchecked by ianwen@chromium.org
lgtm? enhanced_bookmark_bridge lives in chrome/browser/enhanced_bookmarks/ folder. On Mon Feb 09 2015 at 2:10:11 PM <commit-bot@chromium.org> wrote: > CQ is trying da patch. Follow status at > https://chromium-cq-status.appspot.com/patch-status/896093007/20001 > > > https://codereview.chromium.org/896093007/ > To unsubscribe from this group and stop receiving emails from it, send an email to chromium-reviews+unsubscribe@chromium.org.
did you miss uploading a new patchset?
New patchsets have been uploaded after l-g-t-m from tedchoc@chromium.org
lgtm with nits https://codereview.chromium.org/896093007/diff/40001/chrome/android/java/src/... File chrome/android/java/src/org/chromium/chrome/browser/EnhancedBookmarksBridge.java (right): https://codereview.chromium.org/896093007/diff/40001/chrome/android/java/src/... chrome/android/java/src/org/chromium/chrome/browser/EnhancedBookmarksBridge.java:250: * Parses the web content of the given tab, and stores salient images to local database. nit: update comment. https://codereview.chromium.org/896093007/diff/40001/chrome/browser/enhanced_... File chrome/browser/enhanced_bookmarks/android/enhanced_bookmarks_bridge.h (right): https://codereview.chromium.org/896093007/diff/40001/chrome/browser/enhanced_... chrome/browser/enhanced_bookmarks/android/enhanced_bookmarks_bridge.h:92: BookmarkImageServiceAndroid* bookmark_image_service_; // weak nit: align or two spaces each? #90-#92
New patchsets have been uploaded after l-g-t-m from kkimlabs@chromium.org
https://codereview.chromium.org/896093007/diff/40001/chrome/android/java/src/... File chrome/android/java/src/org/chromium/chrome/browser/EnhancedBookmarksBridge.java (right): https://codereview.chromium.org/896093007/diff/40001/chrome/android/java/src/... chrome/android/java/src/org/chromium/chrome/browser/EnhancedBookmarksBridge.java:250: * Parses the web content of the given tab, and stores salient images to local database. On 2015/02/09 22:29:44, Kibeom Kim wrote: > nit: update comment. Done. https://codereview.chromium.org/896093007/diff/40001/chrome/browser/enhanced_... File chrome/browser/enhanced_bookmarks/android/enhanced_bookmarks_bridge.h (right): https://codereview.chromium.org/896093007/diff/40001/chrome/browser/enhanced_... chrome/browser/enhanced_bookmarks/android/enhanced_bookmarks_bridge.h:92: BookmarkImageServiceAndroid* bookmark_image_service_; // weak On 2015/02/09 22:29:44, Kibeom Kim wrote: > nit: align or two spaces each? #90-#92 Done.
The CQ bit was checked by ianwen@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/896093007/60001
Message was sent while issue was closed.
Committed patchset #4 (id:60001)
Message was sent while issue was closed.
Patchset 4 (id:??) landed as https://crrev.com/6a6dc80aab193de63e92ead8b97cf33a6e925fee Cr-Commit-Position: refs/heads/master@{#315454} |