Make base::RefCounted::DeleteInternal a function template

base::RefCounted{,ThreadSafe}::DeleteInternal cause a compile error if
all of below met:
 - The pointee class has a private destructor that RefCounted cannot
   access.
 - A Traits is given to delete the pointee.
 - On a component build on windows.
 - The pointee class is has XXX_EXPORT.
That implies, a subclass of base::RefCounted needs to mark
base::RefCounted as friend for the unused DeleteInternal.

That is, on Windows component build, all methods of an instantiated
class template are also instantiated for exporting.
So, RefCounted::DeleteInternal for an exported ref counted class
is instantiated even though it's never called, and it hits an error
by touching the private dtor of the pointee class.

This CL converts DeleteInternal to a function template, so that
it's not instantiated.

Bug: 763844
Change-Id: I681c8a2eaedd88d2e864719ba8edf2f423e956f5
Reviewed-on: https://chromium-review.googlesource.com/686954
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#504715}

CrOS-Libchrome-Original-Commit: a52799b9768d08e97e539d74675b9e62fa64e6ed
2 files changed
tree: 4ddab3eb6b02cc82f193ca105de1faad2f8ea3ce
  1. base/
  2. build/
  3. components/
  4. dbus/
  5. device/
  6. ipc/
  7. mojo/
  8. testing/
  9. third_party/
  10. ui/