freaking1 / crashpad

Automatically exported from code.google.com/p/crashpad
0 stars 0 forks source link

The Snapshot interface is too consty #9

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
There’s too much constness in the Snapshot interface, which imposes unfair 
restrictions on implementations.

In 40b931bd8eab, I added ProcessSnapshotMinidump, and it would have been very 
nice to make it only load information on demand as needed. Unfortunately, the 
over-constness of the interface made this impossible. I left behind this TODO 
in AnnotationsSimpleMap(), which is required to be declared const:

  // TODO(mark): This method should not be const, although the interface
  // currently imposes this requirement. Making it non-const would allow
  // annotations_simple_map_ to be lazily constructed: InitializeCrashpadInfo()
  // could be called here, and from other locations that require it, rather than
  // calling it from Initialize().

The same pattern came up again in https://codereview.chromium.org/972383002/, 
where it would have been nice to initialize Modules() lazily, but the const 
requirement makes this impossible.

Original issue reported on code.google.com by mark@chromium.org on 3 Mar 2015 at 10:49