|
|
Chromium Code Reviews|
Created:
4 years, 2 months ago by mattreynolds Modified:
4 years, 2 months ago CC:
chromium-reviews, agrieve+watch_chromium.org, mmocny Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionAdd a Physical Web JNI bridge to support native Physical Web clients
On Android, the Physical Web scanner is implemented in the Java layer.
To support native Physical Web clients, the metadata about nearby URLs is
made available via a JNI bridge. If the native client has also registered
as a Physical Web listener, it will also be notified whenever a nearby URL
is found or lost, or when the estimated distance to the device broadcasting
the URL is updated.
This change includes the methods necessary to initialize the bridge.
BUG=636490
Committed: https://crrev.com/144c8c4437f3ceae3dfe8d07e8a76aaf3e3e7a0f
Cr-Commit-Position: refs/heads/master@{#424843}
Patch Set 1 #Patch Set 2 : rebase, fix import order #
Total comments: 10
Patch Set 3 : changes for cco3@ #Patch Set 4 : split #
Total comments: 3
Patch Set 5 : avoid unnecessarily creating global ref #Patch Set 6 : remove env param #Patch Set 7 : remove @CalledByNative annotation on unused method #
Messages
Total messages: 46 (22 generated)
Description was changed from ========== Add a Physical Web JNI bridge to support native Physical Web clients On Android, the Physical Web scanner is implemented in the Java layer. To support native Physical Web clients, the metadata about nearby URLs is made available via a JNI bridge. If the native client has also registered as a Physical Web listener, it will also be notified whenever a nearby URL is found or lost, or when the estimated distance to the device broadcasting the URL is updated. BUG=636490 ========== to ========== Add a Physical Web JNI bridge to support native Physical Web clients On Android, the Physical Web scanner is implemented in the Java layer. To support native Physical Web clients, the metadata about nearby URLs is made available via a JNI bridge. If the native client has also registered as a Physical Web listener, it will also be notified whenever a nearby URL is found or lost, or when the estimated distance to the device broadcasting the URL is updated. BUG=636490 ==========
mattreynolds@chromium.org changed reviewers: + cco3@chromium.org
It might get through reviews faster if you break it up (maybe implement each method separately, starting with the init). Just a suggestion. https://codereview.chromium.org/2377513002/diff/20001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java (right): https://codereview.chromium.org/2377513002/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java:197: @VisibleForTesting This shouldn't be needed anymore (removeUrl is now called in upstream code) https://codereview.chromium.org/2377513002/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java:202: if (mNearbyUrls.contains(urlInfo.getUrl())) { Could you just negate this? if (!) return https://codereview.chromium.org/2377513002/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java:270: * Gets all UrlInfos and PwsResults for nearby URLs and returns them as I think standard javadoc has one short sentence and then the rest of the description on a separate line. https://codereview.chromium.org/2377513002/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java:663: private void onNativeLaunched() { does this get called magically? I couldn't find it in the .cc. https://codereview.chromium.org/2377513002/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java:696: if (!isNativeInitialized()) { Would it be a good idea to push the !onboarding checks here? We could call it safeNotify[...]
https://codereview.chromium.org/2377513002/diff/20001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java (right): https://codereview.chromium.org/2377513002/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java:197: @VisibleForTesting On 2016/10/07 20:40:42, cco3 wrote: > This shouldn't be needed anymore (removeUrl is now called in upstream code) Done. https://codereview.chromium.org/2377513002/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java:202: if (mNearbyUrls.contains(urlInfo.getUrl())) { On 2016/10/07 20:40:42, cco3 wrote: > Could you just negate this? if (!) return Done. https://codereview.chromium.org/2377513002/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java:270: * Gets all UrlInfos and PwsResults for nearby URLs and returns them as On 2016/10/07 20:40:43, cco3 wrote: > I think standard javadoc has one short sentence and then the rest of the > description on a separate line. Done. https://codereview.chromium.org/2377513002/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java:663: private void onNativeLaunched() { On 2016/10/07 20:40:42, cco3 wrote: > does this get called magically? I couldn't find it in the .cc. It should be called from the constructor but it looks like I lost it. I added it back, and renamed the method to make it clearer what it's doing. https://codereview.chromium.org/2377513002/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java:696: if (!isNativeInitialized()) { On 2016/10/07 20:40:43, cco3 wrote: > Would it be a good idea to push the !onboarding checks here? We could call it > safeNotify[...] Done.
LGTM
Good idea, I'll split this CL
Description was changed from ========== Add a Physical Web JNI bridge to support native Physical Web clients On Android, the Physical Web scanner is implemented in the Java layer. To support native Physical Web clients, the metadata about nearby URLs is made available via a JNI bridge. If the native client has also registered as a Physical Web listener, it will also be notified whenever a nearby URL is found or lost, or when the estimated distance to the device broadcasting the URL is updated. BUG=636490 ========== to ========== Add a Physical Web JNI bridge to support native Physical Web clients On Android, the Physical Web scanner is implemented in the Java layer. To support native Physical Web clients, the metadata about nearby URLs is made available via a JNI bridge. If the native client has also registered as a Physical Web listener, it will also be notified whenever a nearby URL is found or lost, or when the estimated distance to the device broadcasting the URL is updated. This change includes the methods necessary to initialize the bridge. BUG=636490 ==========
mattreynolds@chromium.org changed reviewers: + dfalcantara@chromium.org
dfalcantara@chromium.org: Please review changes in
https://codereview.chromium.org/2377513002/diff/60001/chrome/browser/android/... File chrome/browser/android/physical_web/physical_web_data_source_android.cc (right): https://codereview.chromium.org/2377513002/diff/60001/chrome/browser/android/... chrome/browser/android/physical_web/physical_web_data_source_android.cc:30: DCHECK(url_manager_.obj()); Should be more straightforward; check: AppBannerManagerAndroid::CreateJavaBannerManager() in C++ and AppBannerManager.create() in Java
https://codereview.chromium.org/2377513002/diff/60001/chrome/browser/android/... File chrome/browser/android/physical_web/physical_web_data_source_android.cc (right): https://codereview.chromium.org/2377513002/diff/60001/chrome/browser/android/... chrome/browser/android/physical_web/physical_web_data_source_android.cc:30: DCHECK(url_manager_.obj()); On 2016/10/11 00:18:07, dfalcantara wrote: > Should be more straightforward; check: > > AppBannerManagerAndroid::CreateJavaBannerManager() in C++ and > AppBannerManager.create() in Java I think you're suggesting we should be able to do initialization in one JNI call (ie, without the native->Java call to get the UrlManager instance). It's possible but I couldn't find a way to do it cleanly. For instance, the Init method already receives a reference to the UrlManager, but to set the url_manager_ member we'd need to cast the PhysicalWebDataSource* to a PhysicalWebDataSourceAndroid* and add a public setter method. It seems cleaner to me to have PhysicalWebDataSourceAndroid make a second call to fetch the UrlManager ref.
lgtm https://codereview.chromium.org/2377513002/diff/60001/chrome/browser/android/... File chrome/browser/android/physical_web/physical_web_data_source_android.cc (right): https://codereview.chromium.org/2377513002/diff/60001/chrome/browser/android/... chrome/browser/android/physical_web/physical_web_data_source_android.cc:30: DCHECK(url_manager_.obj()); On 2016/10/11 19:44:35, mattreynolds wrote: > On 2016/10/11 00:18:07, dfalcantara wrote: > > Should be more straightforward; check: > > > > AppBannerManagerAndroid::CreateJavaBannerManager() in C++ and > > AppBannerManager.create() in Java > > I think you're suggesting we should be able to do initialization in one JNI call > (ie, without the native->Java call to get the UrlManager instance). It's > possible but I couldn't find a way to do it cleanly. For instance, the Init > method already receives a reference to the UrlManager, but to set the > url_manager_ member we'd need to cast the PhysicalWebDataSource* to a > PhysicalWebDataSourceAndroid* and add a public setter method. It seems cleaner > to me to have PhysicalWebDataSourceAndroid make a second call to fetch the > UrlManager ref. Oh, I was actually referring to the thing you changed between patch sets; you didn't need to make the local ref to make the global ref. Sorry for being unclear!
The CQ bit was checked by mattreynolds@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from cco3@chromium.org Link to the patchset: https://codereview.chromium.org/2377513002/#ps80001 (title: "avoid unnecessarily creating global ref")
Oh okay, thanks Dan!
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator/bui...)
The CQ bit was checked by mattreynolds@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from cco3@chromium.org, dfalcantara@chromium.org Link to the patchset: https://codereview.chromium.org/2377513002/#ps100001 (title: "remove env param")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator/bui...)
The CQ bit was checked by mattreynolds@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from cco3@chromium.org, dfalcantara@chromium.org Link to the patchset: https://codereview.chromium.org/2377513002/#ps120001 (title: "remove @CalledByNative annotation on unused method")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator/bui...)
The CQ bit was checked by mattreynolds@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator/bui...)
The CQ bit was checked by mattreynolds@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator/bui...)
The CQ bit was checked by mattreynolds@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator/bui...)
The CQ bit was checked by mattreynolds@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Description was changed from ========== Add a Physical Web JNI bridge to support native Physical Web clients On Android, the Physical Web scanner is implemented in the Java layer. To support native Physical Web clients, the metadata about nearby URLs is made available via a JNI bridge. If the native client has also registered as a Physical Web listener, it will also be notified whenever a nearby URL is found or lost, or when the estimated distance to the device broadcasting the URL is updated. This change includes the methods necessary to initialize the bridge. BUG=636490 ========== to ========== Add a Physical Web JNI bridge to support native Physical Web clients On Android, the Physical Web scanner is implemented in the Java layer. To support native Physical Web clients, the metadata about nearby URLs is made available via a JNI bridge. If the native client has also registered as a Physical Web listener, it will also be notified whenever a nearby URL is found or lost, or when the estimated distance to the device broadcasting the URL is updated. This change includes the methods necessary to initialize the bridge. BUG=636490 ==========
Message was sent while issue was closed.
Committed patchset #7 (id:120001)
Message was sent while issue was closed.
Description was changed from ========== Add a Physical Web JNI bridge to support native Physical Web clients On Android, the Physical Web scanner is implemented in the Java layer. To support native Physical Web clients, the metadata about nearby URLs is made available via a JNI bridge. If the native client has also registered as a Physical Web listener, it will also be notified whenever a nearby URL is found or lost, or when the estimated distance to the device broadcasting the URL is updated. This change includes the methods necessary to initialize the bridge. BUG=636490 ========== to ========== Add a Physical Web JNI bridge to support native Physical Web clients On Android, the Physical Web scanner is implemented in the Java layer. To support native Physical Web clients, the metadata about nearby URLs is made available via a JNI bridge. If the native client has also registered as a Physical Web listener, it will also be notified whenever a nearby URL is found or lost, or when the estimated distance to the device broadcasting the URL is updated. This change includes the methods necessary to initialize the bridge. BUG=636490 Committed: https://crrev.com/144c8c4437f3ceae3dfe8d07e8a76aaf3e3e7a0f Cr-Commit-Position: refs/heads/master@{#424843} ==========
Message was sent while issue was closed.
Patchset 7 (id:??) landed as https://crrev.com/144c8c4437f3ceae3dfe8d07e8a76aaf3e3e7a0f Cr-Commit-Position: refs/heads/master@{#424843} |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
