What happens to the return array of hook_views_default_views after the function finishes? hook_views_default_views returns an array of $views objects. Immediately after that function has finished, where does it send the $views object it returns?

Obviously that array is passed to another function where it's iterated over and something is done with the data. That's what I want to investigate - what views is doing with the data.

I checked views.module and other files and saw a lot of references to ctools functions, but then got a little lost.

What and where is the function that handles that return value?
ADDITION/CORRECTION:

For Views in Drupal7, the cache is built up by Ctools and its _ctools_export_get_defaults() function that is defined in .../ctools/includes/export.inc.  It is called many ways down the line from views_get_all_views():

function views_get_all_views($reset = FALSE) {
  ctools_include('export');
  return ctools_export_crud_load_all('views_view', $reset);
}


where ctools_export_crud_load_all() eventually calls it.  The kicker for grep'ing around to find this is that it uses $function = $module . '_' . $export['default hook']; to cycle through all the modules that implement the hook, and that is defined in views.install:

'default hook' =&gt; 'views_default_views',


so it certainly took a bit to find but it is a nice api way to allow all sorts of modules to export objects in a defined fashion.  I won't include the code here as it's a bit more verbose than the D6 version below but do let me know if you need any other help on this.

MY BAD:  The following for D6....D7 answer above but I'll keep this in here if anyone in D6land ever needs an answer:

If what you are asking is where does Views build up its cache of default views, it does this via the _views_discover_default_views() function found in .../views/includes/cache.inc:

/**
 * Scan all modules for default views and rebuild the default views cache.
 *
 * @return An associative array of all known default views.
 */
function _views_discover_default_views($reset = FALSE) {
  static $cache = NULL;

  if (!isset($cache) || $reset) {
    $index = views_cache_get('views_default_views_index', TRUE);

    // Retrieve each cached default view
    if (!$reset &amp;&amp; isset($index-&gt;data) &amp;&amp; is_array($index-&gt;data)) {
      $cache = array();
      foreach ($index-&gt;data as $view_name) {
        $data = views_cache_get('views_default:' . $view_name, TRUE);
        if (isset($data-&gt;data) &amp;&amp; is_object($data-&gt;data)) {
          $cache[$view_name] = $data-&gt;data;
        }
      }
    }
    // If missing index, rebuild the cache
    else {
      views_include_default_views();
      $cache = array();

      foreach (module_implements('views_default_views') as $module) {
        $results = call_user_func($module . "_views_default_views");
        if (!empty($results) &amp;&amp; is_array($results)) {
          foreach($results as $name =&gt; $view) {
            // Only views with a sufficiently high api version are eligible.
            if (!empty($view-&gt;api_version) &amp;&amp; $view-&gt;api_version &gt;= 2) {
              // Do not cache dead handlers.
              $view-&gt;destroy();
              if (!isset($cache[$name])) {
                $cache[$name] = $view;
              }
              else {
                watchdog('view', "View name '@name' is already taken", array('@name' =&gt; $name), WATCHDOG_ERROR);
              }
            }
          }
        }
      }

      // Allow modules to modify default views before they are cached.
      drupal_alter('views_default_views', $cache);

      // Cache the index
      $index = array_keys($cache);
      views_cache_set('views_default_views_index', $index, TRUE);

      // Cache each view
      foreach ($cache as $name =&gt; $view) {
        views_cache_set('views_default:' . $name, $view, TRUE);
      }
    }
  }

  return $cache;
}