Refactor around ppb_nacl_private_impl and TrustedPluginChannel.
commitdcefec1ef5c161c2eb733ab3d514b2331ac73975
authorhidehiko@chromium.org <hidehiko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Fri, 4 Apr 2014 04:45:23 +0000 (4 04:45 +0000)
committerhidehiko@chromium.org <hidehiko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Fri, 4 Apr 2014 04:45:23 +0000 (4 04:45 +0000)
treed69c2a44e70c33dd1990c59c15fdd476924dc9af
parentd2b4d345899c66b1a04e0794e4f97bfca29922d9
Refactor around ppb_nacl_private_impl and TrustedPluginChannel.

This is the preparation to add new IPC channel for EmbedderServiceChannel.
This contains several small refactoring:
1) Introduces IsValidChannelHandle() to avoid copy-and-paste code.
2) Removes unnecessary "static" keywords.
3) Uses base::Callback instead of PP_CompletionCallback for
   TrustedPluginChannel. After we add EmbedderServiceChannel, it is
   necessary to wait that the channels are established in parallel.
   So, the callback needs to count the number of invocations.
   base::Callback makes it much easier than PP_CompletionCallback.
4) Removes unnecessary include directive from the header file.
   Instead, uses forward declaration.
5) Invokes connected_callback in dtor if it is not called yet.
6) Invokes completion_callback if trusted plugin channel is somehow
   accidentally not created to handle error properly.

TEST=Ran trybots.
BUG=358431

Review URL: https://codereview.chromium.org/224003002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261675 0039d316-1c4b-4281-b951-d872f2087c98
components/nacl/renderer/ppb_nacl_private_impl.cc
components/nacl/renderer/trusted_plugin_channel.cc
components/nacl/renderer/trusted_plugin_channel.h