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

Issue 2425923003: Replaced is_null() with is_valid in SurfaceId and related classes. (Closed)

Created:
4 years, 2 months ago by Alex Z.
Modified:
4 years, 1 month ago
CC:
anandc+watch-blimp_chromium.org, bgoldman+watch-blimp_chromium.org, cc-bugs_chromium.org, chromium-reviews, creis+watch_chromium.org, danakj+watch_chromium.org, darin-cc_chromium.org, dtrainor+watch-blimp_chromium.org, gcasto+watch-blimp_chromium.org, jam, jbauman+watch_chromium.org, jessicag+watch-blimp_chromium.org, kalyank, khushalsagar+watch-blimp_chromium.org, kmarshall+watch-blimp_chromium.org, lethalantidote+watch-blimp_chromium.org, maniscalco+watch-blimp_chromium.org, marcinjb+watch-blimp_chromium.org, nasko+codewatch_chromium.org, nona+watch_chromium.org, nyquist+watch-blimp_chromium.org, perumaal+watch-blimp_chromium.org, piman+watch_chromium.org, rjkroege, scf+watch-blimp_chromium.org, shaktisahu+watch-blimp_chromium.org, shuchen+watch_chromium.org, sievers+watch_chromium.org, sriramsr+watch-blimp_chromium.org, steimel+watch-blimp_chromium.org, James Su, Ian Vollick, yusukes+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

This CL changes is_null() in SurfaceId, FrameSinkId and LocalFrameId (IDs in the following paragraphs) to is_valid() with slightly different logic. is_null() returns false if any field of the class is set to a non- default value. We used to assume that an ID being not null is equivalent to being valid. is_valid() returns true if all fields of an ID are set (FrameSinkId is a special case where FrameSinkId::is_valid() returns true if either of its fields is non-zero). Thus, a valid ID is always not null but not the other way around. is_valid() poses a more strict check than !is_null() and would help us catch bugs where a class is only partially initialized. For example, CL 2447143003 fixed a bug where we were not waiting long enough for LayerTreeHostInProcess::SetFrameSinkId() to be called by an IPC. The bug resulted in SurfaceLayer::destroy_sequence_ having an empty FrameSinkId when SurfaceLayer::SatisfyDestroySequence() is called. destroy_sequence_ had non-zero sequence_ and thus is not null. Using is_valid() instead of is_null() would help us catch bugs like this. Moreover, a LocalFrameId with a 0 (uninitialized) nonce is invalid but it may pass the !is_null() check if the local_id is set. We do not want to deal with invalid LocalFrameIds in the browser or window server. BUG=656639 CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_precise_blink_rel TBR=dtrainor@chromium.org;torne@chromium.org Committed: https://crrev.com/f907282ab306ec48f3392350b4269ce8f71257b2 Cr-Commit-Position: refs/heads/master@{#431029}

Patch Set 1 #

Patch Set 2 : Changed exo code to use is_valid() #

Patch Set 3 : Fixed compile errors in mac and android code #

Patch Set 4 : Fixed a bug in FrameSinkId::is_valid() where it returns true only when both fields are non-zero #

Patch Set 5 : Another compile error in Android #

Patch Set 6 : More fixes in android #

Patch Set 7 : Fixed broken unit tests with 0 nonce #

Patch Set 8 : Added printf for debugging #

Patch Set 9 : More printf for debugging #

Patch Set 10 : Removed added printf statements; LocalFrameId::is_valid() no longer checks if nonce is 0. #

Total comments: 4

Patch Set 11 : Removed is_null() and LocalFrameId::is_valid() is now checking if nonce_ != 0 #

Patch Set 12 : Replaced FrameSinkId(0, 0) with a constexpr in surface_factory_test #

Patch Set 13 : Added DCHECK to ensure frame_sink_id_ is set before returning the surface_sequence_generator_ in La… #

Patch Set 14 : Rebase #

Patch Set 15 : Removed printf statements that was added for debug; minor bug fixes #

Patch Set 16 : Fixed an exo compile error #

Total comments: 6

Patch Set 17 : Removed a unrelated comment #

Patch Set 18 : Rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+113 lines, -114 lines) Patch
M android_webview/browser/hardware_renderer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 5 chunks +7 lines, -7 lines 0 comments Download
M android_webview/browser/surfaces_instance.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 4 chunks +4 lines, -4 lines 0 comments Download
M blimp/client/core/compositor/blimp_compositor.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +3 lines, -3 lines 0 comments Download
M cc/layers/surface_layer.cc View 8 9 10 11 12 13 14 15 16 4 chunks +4 lines, -4 lines 0 comments Download
M cc/layers/surface_layer_impl.cc View 1 chunk +1 line, -1 line 0 comments Download
M cc/layers/surface_layer_impl_unittest.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M cc/layers/surface_layer_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +2 lines, -2 lines 0 comments Download
M cc/surfaces/direct_compositor_frame_sink.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +3 lines, -3 lines 0 comments Download
M cc/surfaces/display.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +3 lines, -3 lines 0 comments Download
M cc/surfaces/frame_sink_id.h View 1 2 3 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M cc/surfaces/local_frame_id.h View 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M cc/surfaces/surface_aggregator_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +4 lines, -5 lines 0 comments Download
M cc/surfaces/surface_factory_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 11 chunks +13 lines, -12 lines 0 comments Download
M cc/surfaces/surface_id.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +2 lines, -2 lines 0 comments Download
M cc/surfaces/surface_sequence.h View 1 2 3 4 5 6 9 10 11 12 13 14 1 chunk +1 line, -1 line 0 comments Download
M cc/test/test_compositor_frame_sink.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +3 lines, -3 lines 0 comments Download
M components/exo/surface.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 4 chunks +4 lines, -4 lines 0 comments Download
M content/browser/frame_host/render_widget_host_view_child_frame.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 8 chunks +8 lines, -8 lines 0 comments Download
M content/browser/frame_host/render_widget_host_view_child_frame_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +1 line, -1 line 0 comments Download
M content/browser/frame_host/render_widget_host_view_guest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 chunks +2 lines, -2 lines 0 comments Download
M content/browser/frame_host/render_widget_host_view_guest_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 4 chunks +4 lines, -4 lines 0 comments Download
M content/browser/renderer_host/delegated_frame_host.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 14 chunks +16 lines, -16 lines 0 comments Download
M content/browser/renderer_host/render_widget_host_view_aura.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +1 line, -1 line 0 comments Download
M content/browser/renderer_host/render_widget_host_view_aura_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 4 chunks +4 lines, -4 lines 0 comments Download
M content/browser/renderer_host/render_widget_host_view_mac.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +1 line, -1 line 0 comments Download
M content/public/test/browser_test_utils.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +1 line, -1 line 0 comments Download
M content/renderer/android/synchronous_compositor_frame_sink.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +2 lines, -2 lines 0 comments Download
M content/renderer/render_widget.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +0 lines, -1 line 0 comments Download
M content/test/content_browser_test_utils_internal.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +1 line, -1 line 0 comments Download
M services/ui/public/cpp/window.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +1 line, -1 line 0 comments Download
M services/ui/ws/frame_generator.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 4 chunks +6 lines, -6 lines 0 comments Download
M services/ui/ws/server_window_compositor_frame_sink.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +2 lines, -2 lines 0 comments Download
M ui/android/delegated_frame_host_android.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +2 lines, -2 lines 0 comments Download
M ui/aura/mus/window_port_mus.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +1 line, -1 line 0 comments Download
M ui/compositor/compositor.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +2 lines, -2 lines 0 comments Download
M ui/compositor/layer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 91 (70 generated)
Fady Samuel
https://codereview.chromium.org/2425923003/diff/180001/cc/surfaces/local_frame_id.h File cc/surfaces/local_frame_id.h (left): https://codereview.chromium.org/2425923003/diff/180001/cc/surfaces/local_frame_id.h#oldcode26 cc/surfaces/local_frame_id.h:26: constexpr bool is_null() const { return local_id_ == 0 ...
4 years, 2 months ago (2016-10-20 12:15:37 UTC) #28
Fady Samuel
It would be nice to revive this CL. I think it's a good cleanup
4 years, 1 month ago (2016-11-01 03:35:40 UTC) #39
Alex Z.
On 2016/11/01 03:35:40, Fady Samuel wrote: > It would be nice to revive this CL. ...
4 years, 1 month ago (2016-11-02 16:55:06 UTC) #40
Alex Z.
torne@chromium.org: Please review changes in android_webview/ dtrainor@chromium.org: Please review changes in ui/android/ sky@chromium.org: Please review ...
4 years, 1 month ago (2016-11-08 21:38:20 UTC) #46
Fady Samuel
Could you please update your description to explain why you're doing this? NOT SurfaceId/FrameSinkId/LocalFrameId::is_null() != ...
4 years, 1 month ago (2016-11-08 22:18:09 UTC) #51
piman
https://codereview.chromium.org/2425923003/diff/300001/cc/layers/surface_layer.cc File cc/layers/surface_layer.cc (right): https://codereview.chromium.org/2425923003/diff/300001/cc/layers/surface_layer.cc#newcode119 cc/layers/surface_layer.cc:119: // Sometime frame_sink_id_ is null What does this comment ...
4 years, 1 month ago (2016-11-08 23:16:34 UTC) #52
Alex Z.
https://codereview.chromium.org/2425923003/diff/300001/cc/layers/surface_layer.cc File cc/layers/surface_layer.cc (right): https://codereview.chromium.org/2425923003/diff/300001/cc/layers/surface_layer.cc#newcode119 cc/layers/surface_layer.cc:119: // Sometime frame_sink_id_ is null On 2016/11/08 23:16:34, piman ...
4 years, 1 month ago (2016-11-09 15:29:15 UTC) #56
Fady Samuel
nits: Could you please point to a specific example or two of where !is_null() is ...
4 years, 1 month ago (2016-11-09 15:54:56 UTC) #58
Alex Z.
On 2016/11/09 15:54:56, Fady Samuel wrote: > nits: Could you please point to a specific ...
4 years, 1 month ago (2016-11-09 16:20:51 UTC) #63
Fady Samuel
On 2016/11/09 16:20:51, StarAZ1 wrote: > On 2016/11/09 15:54:56, Fady Samuel wrote: > > nits: ...
4 years, 1 month ago (2016-11-09 16:24:32 UTC) #66
Fady Samuel
On 2016/11/09 16:20:51, StarAZ1 wrote: > On 2016/11/09 15:54:56, Fady Samuel wrote: > > nits: ...
4 years, 1 month ago (2016-11-09 16:24:32 UTC) #67
Alex Z.
On 2016/11/09 16:24:32, Fady Samuel wrote: > On 2016/11/09 16:20:51, StarAZ1 wrote: > > On ...
4 years, 1 month ago (2016-11-09 16:29:41 UTC) #69
piman
lgtm
4 years, 1 month ago (2016-11-09 16:35:46 UTC) #71
Fady Samuel
lgtm, I think this is an important change because it prevents us from accidentally assuming ...
4 years, 1 month ago (2016-11-09 16:37:16 UTC) #72
sky
LGTM
4 years, 1 month ago (2016-11-09 16:37:32 UTC) #73
reveman
components/exo lgtm
4 years, 1 month ago (2016-11-09 17:31:29 UTC) #76
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2425923003/340001
4 years, 1 month ago (2016-11-09 21:00:41 UTC) #83
commit-bot: I haz the power
Committed patchset #18 (id:340001)
4 years, 1 month ago (2016-11-09 21:07:47 UTC) #87
commit-bot: I haz the power
Patchset 18 (id:??) landed as https://crrev.com/f907282ab306ec48f3392350b4269ce8f71257b2 Cr-Commit-Position: refs/heads/master@{#431029}
4 years, 1 month ago (2016-11-09 21:15:17 UTC) #89
David Trainor- moved to gerrit
blimp/ lgtm
4 years, 1 month ago (2016-11-09 21:27:44 UTC) #90
Torne
4 years, 1 month ago (2016-11-10 13:40:44 UTC) #91
Message was sent while issue was closed.
android_webview LGTM, sorry for the delay.

Powered by Google App Engine
This is Rietveld 408576698