New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 845086 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: May 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Improve error checking for base::ReadOnlySharedMemoryRegion::Create

Project Member Reported by dcheng@chromium.org, May 21 2018

Issue description

Since this returns a struct containing both a mapping and a region, it's not always clear what the best way to check for error is--so some code actually checks that both objects are valid. I would assume that they're either both valid or both invalid though...

Maybe we should wrap it in an Optional? (This was inspired when reviewing https://chromium-review.googlesource.com/c/chromium/src/+/1055202)
 

Comment 1 by digit@google.com, May 21 2018

Good idea. Either that, or adding an IsValid() to the struct itself?

Comment 2 by dcheng@chromium.org, May 21 2018

That would work as well, yeah.
Status: Started (was: Assigned)
Project Member

Comment 4 by bugdroid1@chromium.org, May 22 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4c9e1d6dda390a3098071eab7d4282f30e462256

commit 4c9e1d6dda390a3098071eab7d4282f30e462256
Author: Alexandr Ilin <alexilin@chromium.org>
Date: Tue May 22 23:42:50 2018

Add IsValid() to the base::MappedReadOnlyRegion

base::MappedReadOnlyRegion is a struct containing both a mapping and a
region. It was not always clear what the best way to check for error.
This CL adds a IsValid() method to this struct that allows to easily
perform the check.

Also this CL makes it explicit that base::MappedReadOnlyRegion has a
mapping and a region that are either both valid or invalid.

TBR=sky@chromium.org

Bug:  845086 
Change-Id: Ia61b12816167592798fc6fcb8e49f09e0198ef48
Reviewed-on: https://chromium-review.googlesource.com/1068930
Commit-Queue: Alexandr Ilin <alexilin@chromium.org>
Reviewed-by: Alexandr Ilin <alexilin@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#560837}
[modify] https://crrev.com/4c9e1d6dda390a3098071eab7d4282f30e462256/base/memory/read_only_shared_memory_region.cc
[modify] https://crrev.com/4c9e1d6dda390a3098071eab7d4282f30e462256/base/memory/read_only_shared_memory_region.h
[modify] https://crrev.com/4c9e1d6dda390a3098071eab7d4282f30e462256/chrome/browser/printing/cloud_print/privet_http_unittest.cc
[modify] https://crrev.com/4c9e1d6dda390a3098071eab7d4282f30e462256/chrome/browser/printing/pwg_raster_converter.cc
[modify] https://crrev.com/4c9e1d6dda390a3098071eab7d4282f30e462256/chrome/browser/ui/webui/print_preview/extension_printer_handler_unittest.cc
[modify] https://crrev.com/4c9e1d6dda390a3098071eab7d4282f30e462256/components/printing/service/pdf_compositor_service_unittest.cc
[modify] https://crrev.com/4c9e1d6dda390a3098071eab7d4282f30e462256/components/visitedlink/browser/visitedlink_master.cc
[modify] https://crrev.com/4c9e1d6dda390a3098071eab7d4282f30e462256/media/base/user_input_monitor.cc
[modify] https://crrev.com/4c9e1d6dda390a3098071eab7d4282f30e462256/media/base/user_input_monitor_unittest.cc
[modify] https://crrev.com/4c9e1d6dda390a3098071eab7d4282f30e462256/services/audio/user_input_monitor_unittest.cc

Comment 5 by dcheng@chromium.org, May 23 2018

Status: Fixed (was: Started)
Thanks for the quick patch
Project Member

Comment 6 by bugdroid1@chromium.org, May 23 2018

Sign in to add a comment